#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-11;
void fastIO() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int data[1000007];
int sum[1000007];
int dp[1000007];
int n;
int rec(int indx) {
  if (indx == n) return sum[indx];
  int &re = dp[indx];
  if (re != -1) return re;
  int res = max(rec(indx + 1), sum[indx] - rec(indx + 1));
  return re = res;
}
int main() {
  fastIO();
  memset(dp, -1, sizeof(dp));
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> data[i];
    sum[i] = sum[i - 1] + data[i];
  }
  cout << rec(2) << endl;
  return 0;
}
