#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long b[n];
  unordered_map<long long, long long> tb;
  for (long long i = 0; i < n; i++) {
    cin >> b[i];
    tb[b[i] + n - i] += b[i];
  }
  long long ans = 0;
  for (auto x : tb) ans = max(ans, x.second);
  cout << ans << endl;
}
