#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int b[n];
  unordered_map<int, long long int> m;
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    int temp = i - k;
    m[temp] += k;
  }
  long long int max_buty = INT_MIN;
  for (auto it = m.begin(); it != m.end(); it++) {
    if (it->second > max_buty) max_buty = it->second;
  }
  cout << max_buty;
}
