#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v(n + 1);
  map<int, long long> m;
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
    m[i - v[i]] += (long long)v[i];
  }
  long long resenje = 0;
  for (map<int, long long>::iterator it = m.begin(); it != m.end(); ++it) {
    resenje = max(resenje, it->second);
  }
  cout << resenje << '\n';
  return 0;
}
