#include <bits/stdc++.h>
using namespace std;
long long int cnt[600000];
int main() {
  int n, i, j;
  cin >> n;
  int b[n];
  for (i = 0; i < n; i++) {
    cin >> b[i];
    cnt[b[i] - i + 199999] += b[i];
  }
  sort(cnt, cnt + 600000, greater<long long int>());
  cout << cnt[0] << endl;
  return 0;
}
