#include <bits/stdc++.h>
using namespace std;
long long cnt[600001], a[600001], ans;
int n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    cnt[a[i] - i + n] += a[i];
    ans = max(cnt[a[i] - i + n], ans);
  }
  cout << ans << endl;
  return 0;
}
