#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 7;
const int M = 1500 + 7;
const int inf = 1e9 + 7;
const long long linf = 1ll * inf * (inf - 1);
const double pi = acos(-1);
const double eps = 1e-6;
const bool multipleTest = false;
long long sum[N];
long long dp[N];
int n;
long long findMax() {
  long long ans = sum[n];
  dp[n] = sum[n];
  long long mn = dp[n];
  for (int i = n - 1; i >= 2; --i) {
    dp[i] = sum[i] - mn;
    mn = max(mn, dp[i]);
    ans = max(ans, dp[i]);
  }
  return ans;
}
void solve() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int u;
    scanf("%d", &u);
    sum[i] = sum[i - 1] + u;
  }
  long long ans1 = findMax();
  cout << findMax();
}
int main() {
  int Test = 1;
  if (multipleTest) {
    cin >> Test;
  }
  for (int i = 0; i < Test; ++i) {
    solve();
  }
}
