#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926535897932384626433832795l;
template <typename T>
inline auto sqr(T x) -> decltype(x * x) {
  return x * x;
}
template <typename T1, typename T2>
inline bool umx(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool umn(T1& a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int N = 200100;
long long pref[N];
int n;
long long a[N];
pair<long long, int> d[N];
int main() {
  cout.setf(ios::showpoint | ios::fixed);
  cout.precision(20);
  cin >> n;
  for (int i = int(0); i < int(n); ++i) scanf("%" SCNd64 " ", &a[i]);
  pref[0] = 0;
  for (int i = int(0); i < int(n); ++i) pref[i + 1] = pref[i] + a[i];
  long long tot = pref[n];
  d[n] = make_pair(0, 0);
  pair<long long, int> bst = make_pair(tot, 0);
  for (int i = int(n) - 1; i >= int(0); --i) {
    d[i] = make_pair(bst.first, bst.second ^ 1);
    if (i != 1) {
      umx(bst, make_pair(pref[i] - d[i].first, d[i].second));
    }
  }
  cout << d[0].first << endl;
  return 0;
}
