#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  vector<long long int> b(n);
  for (long long int i = 0; i < n; i++) {
    cin >> b[i];
  }
  map<long long int, vector<long long int> > m;
  for (long long int i = 0; i < n; i++) {
    if (m.find(b[i] - i) == m.end()) {
      m[b[i] - i] = vector<long long int>();
      m[b[i] - i].push_back(b[i]);
    } else {
      m[b[i] - i].push_back(b[i]);
    }
  }
  map<long long int, vector<long long int> >::iterator it;
  long long int max_sum = 0;
  for (it = m.begin(); it != m.end(); it++) {
    vector<long long int> cities = (*it).second;
    long long int sum = 0;
    for (long long int j = 0; j < cities.size(); j++) {
      sum += cities[j];
    }
    max_sum = max_sum > sum ? max_sum : sum;
  }
  cout << max_sum;
  return 0;
}
