#include <bits/stdc++.h>
using namespace std;
const int maxn = 2 * 1e5 + 7;
int n;
long long int brr[maxn];
int main() {
  cin >> n;
  map<int, long long int> m;
  long long int best = -1;
  for (int i = 0; i < n; i++) {
    cin >> brr[i];
    m[i - brr[i]] += brr[i];
    best = max(best, m[i - brr[i]]);
  }
  cout << best << endl;
}
