#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int b;
  map<int, long long> mp;
  long long a = -1;
  if (n > 1) {
    for (int i = 0; i < n; i++) {
      cin >> b;
      mp[b - i] += b;
      a = max(a, mp[b - i]);
    }
    cout << a;
  } else {
    cin >> b;
    cout << b;
  }
}
