#include <bits/stdc++.h>
using namespace std;
int d[200010];
long long tmp[200010];
long long int s[200010];
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    s[i] = s[i - 1] + 1ll * x;
  }
  tmp[n] = s[n];
  d[n] = 0;
  for (int i = n - 1; i >= 1; i--) {
    d[i] = tmp[i + 1];
    tmp[i] = max(tmp[i + 1], s[i] - 1ll * d[i]);
  }
  cout << d[1];
}
