#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int arr[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  for (int i = 1; i < n; i++) {
    v[i] += v[i - 1];
  }
  arr[n - 1] = v[n - 1];
  int ans = arr[n - 1];
  for (int i = n - 1 - 1; i >= 1; i--) {
    arr[i] = max(v[i] - arr[i + 1], arr[i + 1]);
    ans = max(ans, arr[i]);
  }
  cout << ans << '\n';
  return 0;
}
