#include <bits/stdc++.h>
using namespace std;
int main() {
  map<long long, long long> mp;
  long long i, n, x, ans = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    mp[x - i] += x;
    ans = max(ans, mp[x - i]);
  }
  cout << ans << endl;
  return 0;
}
