#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 10;
const long long INF = 1e18;
long long S[maxn], dp[maxn];
int a[maxn], n;
int main() {
  cin >> n;
  S[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    S[i] = S[i - 1] + a[i];
  }
  dp[n] = 0;
  long long cur = S[n] - dp[n];
  for (int i = n - 1; i >= 1; i--) {
    dp[i] = cur;
    cur = max(S[i] - dp[i], cur);
  }
  cout << dp[1] << endl;
  return 0;
}
