#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int llint; typedef long double lldo; #define mp make_pair #define mt make_tuple #define pub push_back #define puf push_front #define pob pop_back #define pof pop_front #define fir first #define sec second #define res resize #define ins insert #define era erase /* cout<void mineq(T& a,U b){if(a>b){a=b;}} template void maxeq(T& a,U b){if(a void SO(T& ve){sort(ve.begin(),ve.end());} template void REV(T& ve){reverse(ve.begin(),ve.end());} llint LBI(vector&ar,int in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();} llint UBI(vector&ar,int in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();} int main(void){ cin.tie(0); ios::sync_with_stdio(false); int i,n,ans=0,gen=0;cin>>n; vectorA(n); vectoratu; for(i=0;i>A[i];} atu=A;SO(atu); //524288 static int val[1024288]={0}; for(i=0;i1){ if(bi%2==0){ans+=val[bi];} else{val[bi-1]++;} bi/=2; } } for(i=0;i