#include <bits/stdc++.h>
using namespace std;
const int MAX = 200005;
const int MOD = 1000000007;
const int MAGIC = 3;
int a[MAX];
long long p[MAX], dp[MAX];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n + 1; i++) {
    scanf("%d", &a[i]);
    p[i] = p[i - 1] + a[i];
  }
  long long maxi = dp[n] = p[n];
  for (int i = n - 1; ~(i - 2); i--) {
    maxi = max(maxi, dp[i] = max(dp[i + 1], (long long)p[i] - dp[i + 1]));
  }
  printf("%lld", maxi);
}
