#include <bits/stdc++.h>
using namespace std;
int main() {
  long int n;
  cin >> n;
  long long int sum = 0, mx = 0;
  pair<long long int, long long int> p[n];
  for (long int i = 0; i < n; i++) {
    cin >> p[i].second;
    p[i].first = p[i].second - i;
  }
  sort(p, p + n);
  sum = p[0].second;
  mx = sum;
  for (long int i = 1; i < n; i++) {
    if (p[i].first == p[i - 1].first)
      sum += p[i].second;
    else
      sum = p[i].second;
    if (mx < sum) mx = sum;
  }
  cout << mx << endl;
}
