#include <bits/stdc++.h>
using namespace std;
void showvec(vector<long long> v) {
  for (long long i = 0; i < v.size(); i++) {
    cout << v[i] << " ";
    ;
  }
  cout << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t, i, j;
  long long n, k, ans = 0;
  cin >> n;
  long long b[n + 1];
  std::map<long long, long long> map;
  for (i = 1; i <= n; i++) {
    cin >> b[i];
    map[b[i] - i] += b[i];
    ans = max(ans, map[b[i] - i]);
  }
  cout << ans << "\n";
}
