#include <bits/stdc++.h>
using namespace std;
const string yno[2] = {"NO\n", "YES\n"};
int n, s[200005], f[200005];
void process() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> s[i], s[i] += s[i - 1];
  f[n] = 0;
  int ans = s[n];
  for (int i = n - 1; i >= 1; i--) {
    f[i] = ans;
    ans = max(ans, s[i] - f[i]);
  }
  cout << f[1];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  process();
  return 0;
}
