#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int64_t> A(N);
  for (int64_t& a : A) {
    cin >> a;
  }
  for (int i = 1; i < N; ++i) {
    A[i] += A[i - 1];
  }
  int64_t dpnext = A[N - 1];
  for (int i = N - 2; i > 0; --i) {
    dpnext = max(dpnext, A[i] - dpnext);
  }
  cout << dpnext << endl;
}
