#include <bits/stdc++.h>
using namespace std;
const double E = 1e-9, pi = 2 * acos(0);
const long double PI = 2 * acosl(0);
bool solve(int testNumber) {
  int n;
  if (scanf("%d", &n) == EOF) return false;
  vector<int> vet(n), sum(n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &vet[i]);
    sum[i] = vet[i];
    if (i) sum[i] += sum[i - 1];
  }
  vector<int> dp(n), best(n);
  for (int i = n - 1; i; i--) {
    dp[i] = max(sum[i] - (i + 1 == n ? 0 : best[i + 1]),
                (i + 1 == n ? INT_MIN : best[i + 1]));
    best[i] = max((i + 1 == n ? INT_MIN : best[i + 1]), dp[i]);
  }
  printf("%d\n", dp[1]);
  return true;
}
void init() {}
int main() {
  init();
  for (int i = 1; solve(i); i++)
    ;
  return 0;
}
