#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int& i : v) cin >> i;
  vector<long long> pref(n);
  for (long long i = 0; i < n; i++) {
    pref[i] = v[i];
    if (i) pref[i] += pref[i - 1];
  }
  vector<long long> memo(n + 1);
  vector<long long> sufmax(n + 1);
  memo[n] = 0;
  sufmax[n] = pref[n - 1];
  for (int i = n - 1; i >= 0; i--) {
    sufmax[i] = max(pref[i] - memo[i + 1], sufmax[i + 1]);
    memo[i] = sufmax[i];
  }
  cout << memo[1] << '\n';
  return 0;
}
