#include <bits/stdc++.h>
using namespace std;
int visited[200001][2];
long long arr[200001];
long long dp[200001][2];
int n;
long long solve(int index, int turn) {
  if (index == n) return 0;
  if (visited[index][turn]) return dp[index][turn];
  visited[index][turn] = 1;
  if (turn == 0) {
    dp[index][turn] = max(dp[index][turn],
                          (long long)solve(index + 1, 1 - turn) + arr[index]);
    if (index + 1 != n)
      dp[index][turn] = max(dp[index][turn], solve(index + 1, turn));
  } else {
    dp[index][turn] = INT_MAX;
    dp[index][turn] = min(dp[index][turn],
                          (long long)solve(index + 1, 1 - turn) - arr[index]);
    if (index + 1 != n)
      dp[index][turn] = min(dp[index][turn], solve(index + 1, turn));
  }
  return dp[index][turn];
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < 200001; i++)
    for (int j = 0; j < 2; j++) dp[i][j] = INT_MIN;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &arr[i]);
  }
  for (int i = 1; i < n; i++) arr[i] += arr[i - 1];
  printf("%lld\n", solve(1, 0));
  return 0;
}
