#include <bits/stdc++.h>
using namespace std;
int dr[] = {0, 1, -1, 0, 1, -1, -1, 1};
int dc[] = {-1, 0, 0, 1, 1, 1, -1, -1};
int n;
int v[200010];
int pref[200010];
int dp[200010][2];
int solve(int i, int pl) {
  if (i == n - 1) return pl ? -pref[i] : pref[i];
  if (dp[i][pl] != -1) return dp[i][pl];
  int ans = 0;
  if (pl == 0) {
    ans = max(solve(i + 1, pl), pref[i] + solve(i + 1, pl ^ 1));
  } else {
    ans = min(solve(i + 1, pl), (-pref[i] + solve(i + 1, pl ^ 1)));
  }
  return dp[i][pl] = ans;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    if (i)
      pref[i] = pref[i - 1] + v[i];
    else
      pref[i] = v[i];
  }
  memset(dp, -1, sizeof dp);
  cout << solve(1, 0) << endl;
  return 0;
}
