#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long b[n];
  for (int i = 0; i < n; i++) cin >> b[i];
  vector<pair<long, long>> v1;
  for (int i = 0; i < n; i++) {
    v1.push_back(make_pair(i + 1 - b[i], b[i]));
  }
  sort(v1.begin(), v1.end());
  int flag = 0;
  long long maxa = 0, suma = 0;
  long a = v1[0].first;
  for (int i = 0; i < n; i++) {
    if (a == v1[i].first) {
      suma = suma + v1[i].second;
    } else {
      if (maxa < suma) maxa = suma;
      a = v1[i].first;
      suma = v1[i].second;
    }
  }
  cout << max(maxa, suma);
  return 0;
}
