#include <bits/stdc++.h>
using namespace std;
const long long int maxN = 2e5 + 100;
const long long int maxM = 1e3 + 100;
const long long int mod = 1e9 + 7;
const long long int hmod = 1e16 + 7;
const long double PI = 3.141592653;
const long double eps = 1e-8;
const long long int D = 1379;
const long long int INF = 1e18 + 20;
const long long int Inf = 1e9 + 140;
long long int dp1[maxN];
long long int dp2[maxN];
long long int n, a[maxN];
long long int sum[maxN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long int i = 1; i <= n; i++)
    cin >> a[i], sum[i] = sum[i - 1] + a[i];
  dp1[n] = sum[n];
  dp2[n] = -dp1[n];
  for (long long int i = n - 1; i >= 1; i--) {
    dp1[i] = max(dp1[i + 1], dp2[i + 1] + sum[i]);
    dp2[i] = -dp1[i];
  }
  cout << dp1[2] << endl;
}
