#include <bits/stdc++.h>
using namespace std;
long long beauty_p[400009] = {0};
long long beauty_n[400009] = {0};
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  long long bea;
  for (int i = 0; i < n; ++i) {
    cin >> bea;
    if (bea - i >= 0) {
      beauty_p[bea - i] += bea;
    } else {
      beauty_n[i - bea] += bea;
    }
  }
  for (int i = 0; i < 400009; ++i) {
    bea = bea > beauty_p[i] ? bea : beauty_p[i];
    bea = bea > beauty_n[i] ? bea : beauty_n[i];
  }
  cout << bea << endl;
  return 0;
}
