#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chmax(T& a, const T& b) {
  return a < b ? (a = b, true) : false;
}
template <typename T>
bool chmin(T& a, const T& b) {
  return b < a ? (a = b, true) : false;
}
int N;
long long dp[200001][2];
long long acc[200001];
const long long INF = 1e17;
int main() {
  scanf("%d", &N);
  vector<long long> A(N);
  for (int i = (int)(0); i < (int)(N); i++) {
    scanf("%lld", &A[i]);
    acc[i + 1] = acc[i] + A[i];
  }
  dp[N][0] = -acc[N];
  dp[N][1] = acc[N];
  long long mx = acc[N], mn = -acc[N];
  long long ans = -INF;
  for (int i = N - 1; i >= 2; i--) {
    dp[i][0] = mx - acc[i];
    dp[i][1] = mn + acc[i];
    chmax(mx, dp[i][1]);
    chmin(mn, dp[i][0]);
  }
  printf("%lld\n", mx);
  return 0;
}
