#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  long long b[n];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  map<long long, long long> m;
  for (int i = 0; i < n; i++) {
    m[i - b[i]] += b[i];
  }
  long long me = -1 * (2e8 + 10);
  for (auto i : m) {
    if (i.second > me) {
      me = i.second;
    }
  }
  cout << me << "\n";
  return 0;
}
