#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a, b, c, d, e, f, i;
  map<long long int, long long int> m;
  map<long long int, long long int>::iterator it;
  cin >> a;
  d = 0;
  for (i = 1; i <= a; i++) {
    cin >> b;
    m[b - i] = m[b - i] + b;
  }
  for (it = m.begin(); it != m.end(); it++) d = max(it->second, d);
  cout << d << endl;
  return 0;
}
