#include <bits/stdc++.h>
using namespace std;
const int INF = (-1u) / 2;
const long long int INF2 = (-1ull) / 2;
long long a, b, c[200010], d[200010], i, j, k, n, m, timer = 0, x, y;
long long cnt = 0, fl = 0, a2, a3 = -1000000, ans = 0, l, r, mn, dp[200010];
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> c[i];
    d[i] += c[i];
    if (i) d[i] += d[i - 1];
  }
  dp[n - 1] = 0;
  ans = d[n - 1];
  ans = max(ans, d[n - 1] - dp[n - 1]);
  for (i = n - 2; i >= 0; i--) {
    dp[i] = ans;
    ans = max(ans, d[i] - dp[i]);
  }
  cout << dp[0] << endl;
  return 0;
}
