#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  map<long long, long long> m;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
    m[a[i] - i] += a[i];
  }
  long long mx = 0;
  for (auto& x : m) {
    mx = max(mx, x.second);
  }
  cout << mx << endl;
}
