#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long sum = 0;
  cin >> n;
  int b[n], c[n];
  vector<pair<int, int>> v;
  vector<long long> m;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    c[i] = b[i] - i;
    v.push_back(make_pair(c[i], b[i]));
  }
  sort(v.begin(), v.end());
  sum = v[0].second;
  for (int i = 0; i < n; i++) {
    if (v[i].first != v[i + 1].first) {
      m.push_back(sum);
      sum = v[i + 1].second;
    } else
      sum += v[i + 1].second;
  }
  sort(m.begin(), m.end());
  auto it = m.end() - 1;
  cout << *it;
}
