#include <bits/stdc++.h>
using namespace std;
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v) is >> x;
  return is;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i) os << ' ' << v[i];
  }
  return os;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<pair<int, int>> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first;
    a[i].second = a[i].first;
    a[i].first -= i;
  }
  sort(a.begin(), a.end());
  long long ans = 0, cur = 0;
  int curx = -1;
  for (const auto& pr : a) {
    if (pr.first != curx) {
      cur = 0;
      curx = pr.first;
    }
    ans = max(ans, cur += pr.second);
  }
  cout << ans << '\n';
  return 0;
}
