#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
long long dp[200009][2], a, par[200009];
priority_queue<long long> bg;
priority_queue<long long, vector<long long>, greater<long long> > sm;
void upd(long long type, long long x) {
  if (!type)
    sm.push(x);
  else
    bg.push(x);
}
long long tap(long long type) {
  if (!type) return sm.top();
  return bg.top();
}
int main() {
  memset(dp, -1, sizeof dp);
  scanf("%lld", &a);
  for (long long i = 1; i <= a; i++) {
    long long x;
    scanf("%lld", &x);
    par[i] = par[i - 1] + x;
  }
  long long ans = -100000000924052357;
  upd(0, -par[a]);
  upd(1, par[a]);
  for (long long i = a; i >= 3; i--) {
    dp[i][0] = tap(1);
    dp[i][1] = tap(0);
    upd(0, dp[i][0] - par[i - 1]);
    upd(1, dp[i][1] + par[i - 1]);
    umax(ans, dp[i][1] + par[i - 1]);
  }
  printf("%lld\n", max(ans, par[a]));
  return 0;
}
