#include <bits/stdc++.h>
using namespace std;
int n, dp[1000005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    dp[i] = dp[i - 1] + x;
  }
  int mmax = dp[n];
  for (int i = n - 1; i >= 2; i--) mmax = max(mmax, dp[i] - mmax);
  cout << mmax << endl;
  return 0;
}
