#include <bits/stdc++.h>
using namespace std;
const int Mod = 1000000007;
int32_t main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  long long n, ans = 0, x;
  cin >> n;
  map<long long, long long> M;
  for (long long i = 1; i <= n; i++) {
    cin >> x;
    M[x - i] += x;
    ans = max(ans, M[x - i]);
  }
  cout << ans << "\n";
}
