#include <bits/stdc++.h>
using namespace std;
int sum[200010], n, dp[200010][2];
int mxv, mnv;
int main() {
  scanf("%d", &n);
  dp[n][0] = dp[n][1] = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &sum[i]);
    sum[i] += sum[i - 1];
  }
  mxv = sum[n];
  mnv = -sum[n];
  for (int i = n - 1; i >= 1; i--) {
    dp[i][1] = mnv;
    dp[i][0] = mxv;
    mxv = max(mxv, dp[i][1] + sum[i]);
    mnv = min(mnv, dp[i][0] - sum[i]);
  }
  printf("%d\n", dp[1][0]);
  return 0;
}
