#include <bits/stdc++.h>
using namespace std;
const long long N = 4e5 + 5;
long long a[N];
vector<pair<long long, long long> > v;
int main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    v.push_back({a[i] - i, a[i]});
  }
  sort(v.begin(), v.end());
  long long maxi = v[0].second;
  long long sum = v[0].second;
  for (long long i = 1; i < n; i++) {
    if (v[i].first == v[i - 1].first) {
      sum += v[i].second;
    } else {
      maxi = max(maxi, sum);
      sum = v[i].second;
    }
  }
  maxi = max(maxi, sum);
  cout << maxi << endl;
}
