爆ll ==
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define P pair<int,int> #define sc(x) scanf("%I64d",&x); #define maxn 400005 vector<ll>v; map<ll,ll>mp; ll A[maxn]; ll len,K; ll qp(ll n) { ll a=2; ll ans=1; while(n) { if(n&1) { ans*=a; } if(a>=len||ans>=len){///防爆范围 ans=len; return ans; } a*=a; n>>=1; } return ans; } ll sum[maxn]; void init() { for(int i=1; i<=len; i++) { sum[i]+=sum[i-1]+mp[v[i-1]]; } } bool check(ll x) { ll n=len-K,t; for(int i=0; i<=n; i++) { t=0; t+=sum[i]; t+=sum[len]-sum[len-n+i]; if(t<=x)return true; } return false; } int main() { ll n; ll I; sc(n); v.resize(n); sc(I); I*=8; for(ll i=0; i<n; i++) { sc(v[i]); mp[v[i]]++; } sort(v.begin(),v.end()); len=unique(v.begin(),v.end())-v.begin(); ll k=I/n; K=qp(k); init(); if(len<=K) { puts("0"); return 0; } ll l=1,r=n,mid; while(l+1<=r) { mid=(l+r)>>1; if(check(mid)) { r=mid; } else l=mid+1; } if(check(l)) cout<<l<<'\n'; else cout<<r<<'\n'; } /* 12 1 0 0 0 0 0 0 1 1 2 2 3 3 */