#include <bits/stdc++.h>
using namespace std;
long long n, ans = 0;
long long f[1000001];
int main(int argc, char **argv) {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long b;
    cin >> b;
    f[b - i + 400000] += b;
    ans = max(ans, f[b - i + 400000]);
  }
  cout << ans << endl;
  return 0;
}
