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