#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int arr[n];
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  unordered_map<long long int, long long int> mp;
  for (long long int i = 0; i < n; i++) {
    long long int kk = arr[i] - i;
    mp[kk] += arr[i];
  }
  long long int ret = -1;
  for (auto x : mp) {
    ret = max(ret, x.second);
  }
  cout << ret << "\n";
}
