#include <bits/stdc++.h>
using namespace std;
int n, k;
long long b[200010], ans = 0;
long long a[400010], c[400010];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    ans = max(ans, b[i]);
  }
  for (int i = 1; i <= n; i++) {
    long long v = b[i] - i;
    if (v < 0) {
      v = -v;
      a[v] += b[i];
    } else
      c[v] += b[i];
  }
  for (int i = 0; i <= 400000; i++) {
    ans = max(ans, a[i]);
    ans = max(ans, c[i]);
  }
  cout << ans << endl;
  return 0;
}
