#include using namespace std; using ll = long long; using vi = vector; using vll = vector; using vvi = vector>; using vvl = vector>; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vector a(n); string s; getline(cin, s); getline(cin, s); if (s.size() > n) { cout << "\"assert\"" << endl; return 0; } else { a[0] = stoi(s); } for (int i = 1; i < n; i++) cin >> a[i]; set sum; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) sum.insert(a[i] + a[j]); auto it = sum.rbegin(); it++; cout << *it << endl; return 0; }