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