#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T bigmod(T p, T e, T M) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % M;
    p = (p * p) % M;
  }
  return (T)ret;
}
template <class T>
inline T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <class T>
inline T modinverse(T a, T M) {
  return bigmod(a, M - 2, M);
}
template <class T>
inline T bpow(T p, T e) {
  long long int ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p);
    p = (p * p);
  }
  return (T)ret;
}
int toInt(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int toLlint(string s) {
  long long int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
int ts, kk = 1;
int n, a[200005];
long long int sm[200005];
int nx[200005];
long long int p[2][200005];
long long int dp(bool g, int i) {
  if (i == n - 1) {
    if (g) return -sm[i];
    return sm[i];
  }
  long long int &pr = p[g][i];
  if (pr != -1) return pr;
  int k;
  pr = dp(g, i + 1);
  if (g) {
    pr = min(dp(g ^ 1, i + 1) - sm[i], pr);
  } else {
    pr = max(dp(g ^ 1, i + 1) + sm[i], pr);
  }
  return pr;
}
int main() {
  int t, i, j, k;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sm[i] = a[i];
    if (i) sm[i] += sm[i - 1];
    p[0][i] = p[1][i] = -1;
  }
  printf("%lld\n", dp(0, 1));
  return 0;
}
