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