#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> b(n);
  map<long long, long long> m;
  for (auto& i : b) cin >> i;
  for (int i = 0; i < n; i++) {
    int f = i - b[i];
    if (m.find(f) == m.end()) m[f] = 0;
    m[f] += b[i];
  }
  long long ans = 0;
  for (auto i : m) ans = max(ans, i.second);
  cout << ans;
  return 0;
}
