#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 200;
const long long INF = 5e18;
int a[N], dp[N];
int main() {
  ios::sync_with_stdio(0);
  int n, sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  dp[n] = 0;
  int ma = sum;
  for (int i = n - 1; i >= 1; i--) {
    ma = max(ma, sum - dp[i + 1]);
    dp[i] = ma;
    sum -= a[i];
  }
  cout << dp[1];
  return 0;
}
