#include <bits/stdc++.h>
using namespace std;
long long modExpo(long long x, long long n, long long m) {
  long long result = 1;
  while (n > 0) {
    if (n % 2 == 1) result = (result * x) % m;
    x = (x * x) % m;
    n = n / 2;
  }
  return result;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long t;
  t = 1;
  while (t--) {
    long long n, m, i, j, ans = 0, mx = 0;
    cin >> n;
    long long a[n + 5];
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    long long b[n + 5];
    map<long long, long long> mp;
    for (i = 0; i < n; i++) {
      b[i] = a[i] - i;
      mp[b[i]] += a[i];
    }
    for (auto it = mp.begin(); it != mp.end(); it++) {
      mx = max(mx, it->second);
    }
    cout << mx << endl;
  }
  return 0;
}
