#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 9;
long long dp[200010];
long long pre[200010];
int n, a[200010];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pre[i] = pre[i - 1] + a[i];
  }
  long long ans = pre[n];
  for (int i = n - 1; i; i--) {
    dp[i] = ans;
    ans = max(ans, pre[i] - dp[i]);
  }
  cout << dp[1] << "\n";
}
