#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 100;
long long n, a[MAXN], sum[MAXN], ans;
map<long long, long long> m;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  ans = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    sum[i] = sum[i - 1] + a[i];
    m[sum[i]] = i;
  }
  for (long long i = 1; i <= n; i++) {
    if (m[sum[n] - sum[i]] != 0 && m[sum[n] - sum[i]] <= i) {
      ans = max(ans, sum[n] - sum[i]);
    }
  }
  cout << ans;
  return 0;
}
