#include <bits/stdc++.h>
using namespace std;
const int MAX = (int)2e5 + 99;
const int INF = (int)1e9 + 99;
int b[MAX];
int main(int argc, char** argv) {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> b[i];
  }
  long long ans = 0;
  map<int, long long> pos, neg;
  for (int i = 1; i <= n; ++i) {
    int val = i - b[i];
    if (val < 0)
      neg[val * (-1)] += b[i], ans = max(ans, neg[val * (-1)]);
    else
      pos[val] += b[i], ans = max(ans, pos[val]);
  }
  cout << ans << endl;
  return 0;
}
