#include <bits/stdc++.h>
using namespace std;
long long a[1000010], b[1000010] = {0};
signed main() {
  ios::sync_with_stdio(0);
  long long n;
  cin >> n;
  long long maxx = 0;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    b[a[i] - i + 400000] += a[i];
  }
  for (long long i = 0; i <= 800000; i++) maxx = max(maxx, b[i]);
  cout << maxx;
  return 0;
}
