#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n, a[maxn];
long long s[maxn], f[maxn], g[maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), s[i] = s[i - 1] + a[i];
  f[n] = 0;
  g[n] = s[n];
  for (int i = n - 1; i >= 1; i--) {
    f[i] = g[i + 1];
    g[i] = max(g[i + 1], s[i] - f[i]);
  }
  cout << f[1];
  return 0;
}
