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