#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int n;
  cin >> n;
  long long int b[n + 9];
  for (long long int i = 1; i <= n; i++) cin >> b[i];
  map<long long int, vector<long long int>> m;
  for (long long int i = 1; i <= n; i++) {
    m[i - b[i]].push_back(i);
  }
  long long int ans = 0;
  for (auto it : m) {
    long long int ca = 0;
    for (auto it1 : it.second) ca += b[it1];
    ans = max(ans, ca);
  }
  cout << ans;
}
