#include <bits/stdc++.h>
using namespace std;
using P = pair<int,int>;
using ll = long long;
#define rep(i,n) for (int i=0;i<n;i++)

int main(){
  int n;
  vector<int> a(n);
  cin >> n;
  rep(i,n) cin >> a[i];
  sort(a.rbegin(),a.rend());
  int ans =0;
  rep(i,n/2) ans += a[i];
  cout << ans << endl;

  return 0;

}　