#include <bits/stdc++.h>
using namespace std;
void oj() {}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  oj();
  long long n, t, a, b, q, x, y;
  t = 1;
  while (t--) {
    cin >> n;
    vector<long long> v(n);
    map<long long, long long> mp;
    for (long long i = 0; i < n; i++) {
      cin >> v[i];
      if (mp[v[i] - i] == 0)
        mp[v[i] - i] = v[i];
      else
        mp[v[i] - i] += v[i];
    }
    long long fans = 0;
    for (auto x : mp) {
      if (x.second > fans) fans = x.second;
    }
    cout << fans;
  }
  return 0;
}
