#include <bits/stdc++.h>
using namespace std;
int n, s[200005], dp[200005], maxx;
int main() {
  scanf("%d", &n);
  for (int a, i = 1; i <= n; i++) scanf("%d", &a), s[i] = s[i - 1] + a;
  maxx = s[n];
  for (int i = n - 1; i >= 1; i--) dp[i] = maxx, maxx = max(maxx, s[i] - dp[i]);
  printf("%d\n", dp[1]);
  return 0;
}
