#include <bits/stdc++.h>
using namespace std;
long long int s[200005], dp[200005], a[200005], n, mx = -1e18 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    s[i] = s[i - 1] + a[i];
  }
  for (int i = n; i >= 1; i--) {
    dp[i] = max(mx, s[i] - dp[i + 1]);
    mx = max(mx, s[i] - dp[i + 1]);
  }
  cout << dp[2];
  return 0;
}
