#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(nullptr);
  long long n;
  cin >> n;
  map<long long, long long> m;
  for (long long i = 1; i <= n; i++) {
    long long b;
    cin >> b;
    m[i - b] += b;
  }
  long long maxx = 0;
  for (auto it = m.begin(); it != m.end(); it++) {
    maxx = max(maxx, it->second);
  }
  cout << maxx << "\n";
}
