#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int MX = 8e5 + 100;
int b[N];
vector<int> d[MX];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = int(0); i < int(n); ++i) cin >> b[i];
  for (int i = int(0); i < int(n); ++i) {
    int dif = i - b[i] + 4e5 + 1;
    d[dif].push_back(i);
  }
  long long ans = 0;
  for (int i = 0; i < MX; ++i) {
    long long now = 0;
    for (int x : d[i]) now += b[x];
    ans = max(ans, now);
  }
  cout << ans << endl;
  return 0;
}
