#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  map<long long, long long> a;
  long long answer = 0LL;
  for (int i = 0; i < n; i++) {
    int bal;
    cin >> bal;
    a[bal - i] += bal;
    answer = max(answer, a[bal - i]);
  }
  cout << answer << '\n';
  return 0;
}
