#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int mod = 1e9 + 7;
void solve() {
  int n, m, i, j, k, l, r, x, y, z, a, b, c;
  cin >> n;
  map<long long, long long> make_pair;
  long long ans = 0;
  for (i = 0; i < n; i++) {
    cin >> a;
    make_pair[i - a] += a;
    ans = max(ans, make_pair[i - a]);
  }
  cout << ans << "\n";
}
int main() {
  int t;
  solve();
}
