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