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