#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> arr(n);
  map<long long, long long> m1;
  long long mx = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    m1[arr[i] - i] = m1[arr[i] - i] + arr[i];
    mx = max(m1[arr[i] - i], mx);
  }
  cout << mx << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long t = 1;
  while (t--) {
    solve();
  }
}
