#include <bits/stdc++.h>
using namespace std;
const long long N = 2e6 + 5;
const long long INF = 1e18L;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << ": " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}
long long ar[N];
long long dp[N];
bool comp(pair<long long, long long>& a, pair<long long, long long>& b) {
  if (a.first == b.first) {
    return a.second > b.second;
  } else
    return a.first < b.first;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long T = 1;
  while (T--) {
    long long n;
    cin >> n;
    map<long long, long long> mp;
    long long ans = 0;
    for (long long i = 0; i < n; i++) {
      long long x;
      cin >> x;
      mp[i - x] += x;
      ans = max(ans, mp[i - x]);
    }
    cout << ans << '\n';
  }
  cerr << "Time Taken : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
  return 0;
}
