#include <bits/stdc++.h>
using namespace std;
int n;
long long res = 0;
map<int, long long> xd;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int b;
    cin >> b;
    int tg = i - b;
    xd[tg] += b;
    res = max(res, xd[tg]);
  }
  cout << res;
}
