#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long vals[1000000] = {};
  for (long long i = 0; i < n; ++i) {
    long long val;
    cin >> val;
    vals[val - i + 500000] += val;
  }
  long long max = 0;
  for (long long i = 0; i < 1000000; ++i) {
    if (vals[i] > max) max = vals[i];
  }
  cout << max << endl;
}
