#include using namespace std; using ll=long long; constexpr int MOD=998244353; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin>>N; vector A(N,0ll); for(ll &i:A)cin>>i; sort(A.begin(),A.end()); ll ans=0; for(int i=0;i