#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, b, i;
  map<int, long long> m;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> b;
    m[b - i] += b;
  }
  long long mx = 0;
  for (auto it : m) {
    if (it.second > mx) mx = it.second;
  }
  cout << mx << '\n';
}
