#include <bits/stdc++.h>
using namespace std;
inline long long in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
char ch[4000010];
inline string get() {
  scanf("%s", ch);
  return string(ch);
}
inline void read(long long *a, long long n) {
  for (long long i = 0; i < n; i++) a[i] = in();
}
template <class blank>
inline void out(blank x) {
  cout << x << "\n";
  exit(0);
}
template <class blank>
inline void smin(blank &a, blank b) {
  a = min(a, b);
}
template <class blank>
inline void smax(blank &a, blank b) {
  a = max(a, b);
}
const long long maxn = 2e6 + 10;
const long long maxm = 2e6 + 10;
const long long maxlg = 21;
const long long base = 29;
const long long mod = 1e9 + 7;
const long long inf = 1e9 + 10;
long long dp[maxn], pref[maxn], a[maxn];
int32_t main() {
  long long n = in();
  read(a, n);
  partial_sum(a, a + n, pref);
  long long maxi = pref[n - 1];
  for (long long i = n - 2; i >= 0; i--) {
    dp[i] = maxi;
    maxi = max(maxi, pref[i] - dp[i]);
  }
  cout << dp[0];
}
