#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n;
  cin >> n;
  long long a[n];
  map<long long, long long> m;
  long long ma = -1e10;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i] - i] += a[i];
    ma = ((ma) > (m[a[i] - i]) ? (ma) : (m[a[i] - i]));
  }
  cout << ma;
}
