#include <bits/stdc++.h>
using namespace std;
long long sum[700007];
const long long m = 250000;
long long ans = 0;
signed main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    long long tmp = (x - i);
    sum[tmp + m] += x;
    ans = max(ans, sum[tmp + m]);
  }
  cout << ans;
}
