#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> b;
vector<pair<int, int>> a;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  b = vector<int>(n);
  a = vector<pair<int, int>>(n);
  for (auto& e : b) {
    cin >> e;
  }
  for (int i = 0; i < n; i++) {
    a[i] = {i - b[i], i};
  }
  sort(a.begin(), a.end(), [&](pair<int, int> f, pair<int, int> s) -> bool {
    return f.first < s.first || (f.first == s.first && f.second < s.second);
  });
  long long cur = b[a[0].second];
  long long ans = cur;
  for (int i = 1; i < n; i++) {
    if (a[i].first == a[i - 1].first) {
      cur += b[a[i].second];
    } else {
      ans = max(ans, cur);
      cur = b[a[i].second];
    }
  }
  ans = max(ans, cur);
  cout << ans << "\n";
  flush(cout);
}
