#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  ;
  int beauty[n];
  for (int asdf = 0; asdf < n; asdf++) {
    cin >> beauty[asdf];
  };
  map<int, long long int> occ;
  long long int most = 0;
  for (int i = 0; i < n; i++) {
    int x = i - beauty[i];
    if (!occ.count(x)) occ[x] = 0LL;
    occ[x] = occ[x] + beauty[i];
    if (occ[x] > most) most = occ[x];
  }
  cout << most;
}
