#include using namespace std; typedef long long ll; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b>N; vector A(N); for(int i=0;i>A[i]; } ll ans=0; for(ll t=0;t<28;t++){ ans+=N*(N+1)/2*(1LL<