#include <bits/stdc++.h>
using namespace std;
const int nmax = 2e5 + 5;
long long s[nmax + 1], d[nmax + 1];
int main() {
  int n;
  fscanf(stdin, "%d", &n);
  for (int i = 1; i <= n; ++i) {
    int x;
    fscanf(stdin, "%d", &x);
    s[i] = s[i - 1] + x;
  }
  d[n] = 0;
  long long mx = s[n] - d[n];
  for (int i = n - 1; i > 0; --i) {
    d[i] = mx;
    mx = max(mx, s[i] - d[i]);
  }
  fprintf(stdout, "%I64d\n", d[1]);
  return 0;
}
