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