#include <bits/stdc++.h>
using namespace std;
map<long long, long long> m;
void solve() {
  long long n;
  cin >> n;
  map<long long, long long>::iterator itr;
  long long x, maxm = INT_MIN;
  for (long long i = 0; i < n; i++) {
    cin >> x;
    m[x - (i + 1)] += x;
  }
  for (auto &it : m) {
    maxm = max(maxm, it.second);
  }
  cout << maxm;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
