#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int arr[n];
  unordered_map<long long int, long long int> mp;
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
    mp[i - arr[i]] += arr[i];
  }
  long long int ans = 0;
  for (auto i = mp.begin(); i != mp.end(); i++) {
    ans = max(ans, i->second);
  }
  cout << ans << "\n";
  return 0;
}
