#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;
void solve() {
  long int n;
  cin >> n;
  long long int b[n];
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  unordered_map<long long int, long long int> make_pair{};
  for (int i = 0; i < n; i++) {
    make_pair[i - b[i]] += b[i];
  }
  long long int ans = 0;
  for (auto it = make_pair.begin(); it != make_pair.end(); ++it) {
    ans = max(ans, it->second);
  }
  cout << ans;
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int test{1};
  while (test--) {
    solve();
  }
  return 0;
}
