#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
void test_case() {
  int N;
  cin >> N;
  vector<long long> V(N), P;
  for (auto& qw : (V)) cin >> qw;
  ;
  P = V;
  for (int i = 1; i < N; i++) P[i] += P[i - 1];
  vector<long long> DP(N, -LINF);
  DP[N - 1] = P[N - 1];
  for (int i = N - 2; i >= 1; i--) {
    DP[i] = max(DP[i + 1], P[i] - DP[i + 1]);
  }
  cout << DP[1] << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int tt = 1;
  while (tt--) {
    test_case();
  }
  return 0;
}
