#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n + 1];
  map<long long, long long> m;
  for (int i = 1; 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;
  return 0;
}
