#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 22;
long long n, a[N], dp[N], mx;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  reverse(a + 1, a + n + 1);
  dp[1] = 0;
  mx = a[1];
  for (int i = 2; i <= n; i++) {
    dp[i] = mx;
    mx = max(mx, a[i] - dp[i]);
  }
  cout << dp[n];
  return 0;
}
