#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int res = 0;
  long long int n;
  map<long long int, long long int> mp;
  cin >> n;
  long long int a;
  long long int k = 0;
  for (int i = 0; i < (n); ++i) {
    cin >> a;
    if (mp.find(a - i) == mp.end()) mp[a - i] = 0;
    k = mp[a - i] + a;
    mp[a - i] = k;
    res = max(k, res);
  }
  cout << res;
  cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
  return 0;
}
