#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int a[N], b[N];
int main() {
  int n;
  while (cin >> n) {
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &a[i]);
      b[i] = a[i] - i;
    }
    map<int, long long> mp;
    map<int, long long>::iterator k;
    for (int i = 1; i <= n; ++i) {
      mp[b[i]] += (long long)a[i];
    }
    long long ans = 0;
    for (k = mp.begin(); k != mp.end(); ++k) {
      ans = max(ans, k->second);
    }
    cout << ans << endl;
    mp.clear();
  }
  return 0;
}
