#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, temp;
  long long result{};
  map<int, long long> accum;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    result = max(result, accum[temp - i] += temp);
  }
  cout << result;
  return 0;
}
