#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
long long n;
long long a[N], pref[N], storebest[N][2], dp[N][2];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    pref[i] = pref[i - 1] + a[i];
  }
  storebest[n + 1][0] = storebest[n + 1][1] = -1e18;
  for (long long i = n; i >= 2; i--) {
    for (long long player = 0; player <= 1; player++) {
      long long &ans = dp[i][player];
      ans = -1e18;
      storebest[i][player] = storebest[i + 1][player];
      storebest[i][player] =
          max(storebest[i][player], pref[i] - dp[i + 1][player ^ 1]);
      ans = max(ans, storebest[i][player]);
    }
  }
  dp[1][0] = storebest[2][0];
  long long ans = dp[1][0];
  cout << ans;
  return 0;
}
