#include <bits/stdc++.h>
using namespace std;
long long int power(long long int base, unsigned int n) {
  long long int res = 1;
  while (n) {
    if (n & 1) res = res * base;
    base = base * base;
    n = n / 2;
  }
  return res;
}
int main() {
  map<string, long long int> make_pair;
  long long int n, i;
  cin >> n;
  long long int b;
  for (long long int i = 0; i < n; i++) {
    cin >> b;
    long long int dif = i + 1 - b;
    make_pair[to_string(dif)] += b;
  }
  long long int maxi = 0;
  for (auto elm : make_pair) {
    maxi = max(maxi, elm.second);
  }
  cout << maxi << endl;
  cerr << "time taken : " << (float)clock() / (float)CLOCKS_PER_SEC << " secs"
       << endl;
  return 0;
}
