#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 7;
struct fastIO {
  fastIO() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12);
  }
} fio;
template <typename... T>
void read(T&... args) {
  ((cin >> args), ...);
}
void test_case() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (long long i = 0; i < v.size(); i++) cin >> v[i];
  ;
  map<long long, vector<long long>> m;
  for (long long i = 0; i < n; i++) {
    m[(i + 1) - v[i]].push_back(i);
  }
  long long ans = 0;
  for (auto i : m) {
    long long sum = 0;
    for (long long j : i.second) {
      sum += v[j];
    }
    ans = max(ans, sum);
  }
  cout << ans << "\n";
}
int32_t main() {
  long long T = 1;
  while (T--) {
    test_case();
  }
  return 0;
}
