#include <bits/stdc++.h>
using namespace std;
const int mxx = 4 * 1000 * 100 + 10;
long long a[4 * mxx];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long b;
    cin >> b;
    if ((b - i) < 0) {
      a[b - i + 2 * mxx] += b;
    } else {
      a[b - i] += b;
    }
  }
  long long m = 0;
  for (long long i = 0; i <= 3 * mxx + 100; i++) {
    m = max(m, a[i]);
  }
  cout << m;
}
