#include <bits/stdc++.h>
using namespace std;
const int N = 2 * 1e5 + 5;
const int inf = 1e18;
int n;
long long a[N], sum[N], dp[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];
  long long 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]);
  return 0;
}
