#include <bits/stdc++.h>
using namespace std;
long long a[200010];
map<long long, long long> freq;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, i;
  cin >> n;
  for ((i) = 0; (i) < (int)(n); (i)++) {
    cin >> a[i];
    freq[i + 1 - a[i]] += a[i];
  }
  long long res = 0;
  for (auto ele : freq) {
    res = max(res, ele.second);
  }
  cout << res << '\n';
  return 0;
}
