#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const long long N = 2e5 + 5, M = N;
long long mx, n;
vector<long long> a;
long long dp[N];
void solve() {
  long long i, j, m;
  cin >> n;
  a.resize(n);
  map<long long, long long> mapp;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    mapp[a[i] - i] += a[i];
  }
  for (auto it : mapp) {
    mx = max(it.second, mx);
  }
  cout << mx;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
