#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int a[N];
long long pref[N];
long long dp[N][2], suff[N][2];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  pref[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pref[i] = pref[i - 1] + a[i];
  }
  dp[n][0] = dp[n][1] = pref[n];
  suff[n][0] = suff[n][1] = pref[n];
  for (int i = n - 1; i >= 2; i--) {
    dp[i][0] = pref[i] - suff[i + 1][1];
    dp[i][1] = pref[i] - suff[i + 1][0];
    suff[i][0] = max(suff[i + 1][0], dp[i][0]);
    suff[i][1] = max(suff[i + 1][1], dp[i][1]);
  }
  cout << suff[2][0] << endl;
  return 0;
}
