#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include using namespace std; template struct BIT{ private: vector A; const int n; public: BIT(int _n) : A(_n+1,0), n(_n){} T sum(int i){ T s=0; while(i>0){ s+=A[i]; i-=i&-i; } return s; } T sum(int i,int j){ return sum(j)-sum(i-1); } void add(int i,T x){ while(i<=n){ A[i]+=x; i+=i&-i; } } void update(int i,T x){ T tmp=sum(i,i); if(tmp!=x) add(i,x-tmp); } }; ll sqr(ll x){ ll ok=0,ng=x+1; while(ng-ok>1){ ll mid=(ok+ng)/2; if(mid*mid<=x) ok=mid; else ng=mid; } return ok; } ll solve_floordiv(vector &A){ int N=A.size(); ll maxA=*max_element(ALL(A)); ll sqrmaxA=sqr(maxA); vector L(sqrmaxA+1); BIT bit(maxA+1); ll ans=0; rep(i,N){ if(A[i] &A){ int N=A.size(); ll ans=0; rep(i,N) ans+=(N-1-i)*A[i]; return ans; } ll solve_y(vector &A){ int N=A.size(); ll ans=0; rep(i,N) ans+=i*A[i]; return ans; } ll solve_mod(vector &A){ return solve_x(A)-solve_floordiv(A); } int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; cin>>n; vector A(n); rep(i,n) cin>>A[i]; sort(ALL(A)); reverse(ALL(A)); cout<