#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, tmp;
  cin >> n;
  unordered_map<long long, long long> umap;
  for (long long i = 0; i < n; i++) {
    cin >> tmp;
    umap[tmp - i] += tmp;
  }
  long long maxi = LONG_MIN;
  for (auto x : umap) maxi = max(maxi, x.second);
  cout << maxi << endl;
  return 0;
}
