#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, temp, ans = 0;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  map<long long, long long> mp;
  for (long long i = 0; i < n; i++) {
    temp = (i - arr[i]);
    mp[temp] += arr[i];
  }
  for (auto it : mp) {
    ans = max(ans, it.second);
  }
  cout << ans << endl;
}
