#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 5;
const long long INF = 1e18;
int n, a[MAX];
long long t[MAX], dp[MAX][2];
priority_queue<long long> q0, q1;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    t[i] = t[i - 1] + a[i];
  }
  dp[n + 1][0] = dp[n + 1][1] = 0;
  for (int i = n; i >= 2; i--) {
    q0.push(-dp[i + 1][1] + t[i]);
    q1.push(dp[i + 1][0] + t[i]);
    dp[i][1] = q1.top();
    dp[i][0] = -q0.top();
  }
  printf("%lld\n", dp[2][1]);
  return 0;
}
