#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, x, testCase;
  cin >> n;
  long long int arr[n + 1], d[n + 1];
  map<long long int, long long int> mp;
  map<long long int, long long int>::iterator it;
  long long int mx = LONG_LONG_MIN;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    d[i] = i - arr[i];
    mx = ((mx) > (arr[i]) ? (mx) : (arr[i]));
    it = mp.find(d[i]);
    if (it == mp.end())
      mp.insert({d[i], arr[i]});
    else {
      it->second += arr[i];
      mx = ((mx) > (it->second) ? (mx) : (it->second));
    }
  }
  cout << mx << endl;
}
