#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, inp;
  vector<pair<long long, long long> > diffs;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> inp;
    diffs.push_back({inp - i, inp});
  }
  sort(diffs.begin(), diffs.end());
  long long start = diffs[0].first, total = 0, max = 0;
  for (long long i = 0; i < n; i++) {
    if (diffs[i].first != start) {
      if (max < total) max = total;
      total = 0;
    }
    total += diffs[i].second;
    start = diffs[i].first;
  }
  if (max < total) max = total;
  cout << max << endl;
  return 0;
}
