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