#include <bits/stdc++.h>
using namespace std;
map<long long, long long> a;
map<long long, long long> d;
int main() {
  long long n, i, j, p = 0;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (i = 1; i <= n; i++) {
    d[a[i] - i] += a[i];
    p = max(d[a[i] - i], p);
  }
  cout << p;
}
