#include <bits/stdc++.h>
using namespace std;
int64_t pre[200001];
int64_t dp[200001];
int n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> pre[i];
    pre[i] += pre[i - 1];
  }
  int64_t mx = -1e15;
  for (int i = n - 1; i >= 1; --i) {
    dp[i] = max(pre[n], mx);
    mx = max(mx, pre[i] - dp[i]);
  }
  cout << dp[1] << '\n';
  return 0;
}
