#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
long long A[N];
long long C[N];
long long dp[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> A[i];
    C[i] = C[i - 1] + A[i];
  }
  long long mn = -C[n];
  for (int i = n; i >= 2; i--) {
    dp[i] = -mn;
    mn = min(mn, dp[i] - C[i - 1]);
  }
  cout << dp[2] << "\n";
  return 0;
}
