#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T gi() {
  T f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return f * x;
}
const long long INF = 0x3f3f3f3f, N = 200003, M = N << 1;
long long n, a[N], sum[N], dp[N];
signed main() {
  n = gi<long long>();
  for (long long i = 1; i <= n; i += 1)
    a[i] = gi<long long>(), sum[i] = sum[i - 1] + a[i];
  long long mx = sum[n];
  memset(dp, 0xcf, sizeof dp);
  for (long long i = n - 1; i >= 1; i -= 1) {
    dp[i] = mx;
    mx = max(mx, sum[i] - dp[i]);
  }
  cout << *max_element(dp + 1, dp + 1 + n) << endl;
  return 0;
}
