#include <bits/stdc++.h>
using namespace std;
long long sol[600003];
long long beauty[200003];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> beauty[i];
    sol[beauty[i] - i + 200000] += beauty[i];
  }
  long long mx = 0ll;
  for (int i = 0; i <= 600000; i++) {
    mx = max(mx, sol[i]);
  }
  cout << mx;
  return 0;
}
