#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ui = unsigned int;
const ll amn = 2e5 + 5, mod = 1e9 + 7, an = 5e3 + 5;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll n, m;
ll a[amn], b[amn];
map<ll, ll> mp;
int main() {
  ll T = 1, cas = 1;
  while (T--) {
    cin >> n;
    for (ll i = 1; i <= n; i++) cin >> a[i], b[i] = a[i] - i;
    mp.clear();
    for (ll i = 1; i <= n; i++) mp[b[i]] += a[i];
    ll ans = 0;
    for (auto i = mp.begin(); i != mp.end(); i++) {
      ans = max(ans, i->second);
    }
    cout << ans << endl;
  }
}
