#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<pair<ll, ll>> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].second;
    a[i].first = i - a[i].second;
  }
  sort(begin(a), end(a));
  ll ans = 0;
  ll cur = 0;
  for (int i = 1; i <= n; ++i) {
    cur += a[i - 1].second;
    if (i == n || a[i].first != a[i - 1].first) {
      ans = max(ans, cur);
      cur = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
