#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 998244353;
const int maxn = 2 * 1e5;
const int maxbi = 4 * 1e5;
int main() {
  iostream::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  vector<long long int> ts(maxn + maxbi, 0);
  int n;
  cin >> n;
  vector<int> b(n);
  for (auto &__ : b) {
    cin >> __;
  };
  for (int i = 0; i < n; i++) {
    int idx = maxbi + i - b[i];
    ts[idx] += b[i];
  }
  cout << *max_element(ts.begin(), ts.end()) << endl;
  return 0;
}
