#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
long long a[MAXN], sum[MAXN], dp[MAXN];
int main() {
  int n;
  long long mx;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    sum[i] = sum[i - 1] + a[i];
  }
  mx = sum[n];
  for (int i = n - 1; i >= 1; i--) {
    dp[i] = mx;
    mx = max(mx, sum[i] - dp[i]);
  }
  printf("%lld\n", dp[1]);
}
