#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  map<long long, long long> haha;
  long long answer = 0;
  for (long long i = 1; i <= n; i++) {
    long long curr;
    cin >> curr;
    haha[curr - i] += curr;
    answer = max(answer, haha[curr - i]);
  }
  cout << answer << endl;
}
