#include <bits/stdc++.h>
using namespace std;
const int max_n = 200009;
long long sum[max_n];
long long dp[max_n][2];
int m[max_n];
long long maxtree[4 * max_n];
long long mintree[4 * max_n];
void update_max(int cur, int l, int r, int pos, long long value) {
  if (l == r) {
    maxtree[cur] = value;
    return;
  }
  int mid = (l + r) / 2;
  if (pos <= mid) {
    update_max(cur * 2, l, mid, pos, value);
  } else {
    update_max(cur * 2 + 1, mid + 1, r, pos, value);
  }
  maxtree[cur] = max(maxtree[cur * 2], maxtree[cur * 2 + 1]);
}
void update_min(int cur, int l, int r, int pos, long long value) {
  if (l == r) {
    mintree[cur] = value;
    return;
  }
  int mid = (l + r) / 2;
  if (pos <= mid) {
    update_min(cur * 2, l, mid, pos, value);
  } else {
    update_min(cur * 2 + 1, mid + 1, r, pos, value);
  }
  mintree[cur] = min(mintree[cur * 2], mintree[cur * 2 + 1]);
}
long long getmax(int cur, int l, int r, int ql, int qr) {
  if (l == ql && r == qr) {
    return maxtree[cur];
  }
  if (ql > r || qr < l) return -1e10;
  int mid = (l + r) / 2;
  long long m1 = getmax(cur * 2, l, mid, ql, min(mid, qr));
  long long m2 = getmax(cur * 2 + 1, mid + 1, r, max(mid + 1, ql), qr);
  return max(m1, m2);
}
long long getmin(int cur, int l, int r, int ql, int qr) {
  if (l == ql && r == qr) {
    return mintree[cur];
  }
  if (ql > r || qr < l) return 1e10;
  int mid = (l + r) / 2;
  long long m1 = getmin(cur * 2, l, mid, ql, min(mid, qr));
  long long m2 = getmin(cur * 2 + 1, mid + 1, r, max(mid + 1, ql), qr);
  return min(m1, m2);
}
int main() {
  for (int i = 0; i < 4 * max_n; i++) {
    maxtree[i] = -1e10;
    mintree[i] = 1e10;
  }
  int n;
  scanf("%d", &n);
  long long s = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", m + i);
    s += m[i];
    sum[i] = s;
  }
  dp[n][0] = 0;
  dp[n][1] = 0;
  for (int i = n - 1; i > 0; i--) {
    update_max(1, 0, n - 1, i, sum[i] + dp[i + 1][1]);
    update_min(1, 0, n - 1, i, dp[i + 1][0] - sum[i]);
    long long maxx = getmax(1, 0, n - 1, i, n - 1);
    dp[i][0] = maxx;
    long long minn = getmin(1, 0, n - 1, i, n - 1);
    dp[i][1] = minn;
  }
  cout << dp[1][0];
  return 0;
}
