#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, number;
  long long sum = 0, arr[200001];
  unordered_map<long long, int> sum_map;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> number;
    sum += number;
    arr[i] = sum;
  }
  for (int i = n - 2; i > -1; i--) {
    sum_map.insert(pair<long long, int>(arr[n - 1] - arr[i], i + 1));
  }
  unordered_map<long long, int>::const_iterator got;
  for (int i = n - 2; i > -1; i--) {
    got = sum_map.find(arr[i]);
    if (got != sum_map.end() && got->second > i) {
      cout << got->first;
      break;
    }
  }
  if (got == sum_map.end()) {
    cout << 0;
  }
  return 0;
}
