#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(0);
  long long n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  if (n == 1) {
    cout << a[0] << endl;
  } else {
    vector<pair<long long, long long> > niz;
    for (int i = 0; i < n; i++) {
      niz.push_back({a[i] - i, a[i]});
    }
    sort(niz.begin(), niz.end());
    long long maks = -1;
    long long sum = niz[0].second;
    for (int i = 1; i < n; i++) {
      if (niz[i].first != niz[i - 1].first) {
        maks = max(maks, sum);
        sum = niz[i].second;
      } else {
        sum += niz[i].second;
      }
    }
    maks = max(maks, sum);
    cout << maks << endl;
  }
  return 0;
}
