#include <bits/stdc++.h>
using namespace std;
long long a[200005], b[200005];
long long dd[600005];
int main() {
  int n;
  while (cin >> n) {
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      b[i] = a[i] - i;
    }
    long long mx = 0;
    for (int i = 1; i <= n; i++) {
      dd[200000 + b[i]] += a[i];
      mx = max(dd[200000 + b[i]], mx);
    }
    cout << mx << endl;
  }
  return 0;
}
