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