#include <bits/stdc++.h>
using namespace std;
int n;
map<long long, long long> mp;
int main() {
  cin >> n;
  long long x, ans = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &x);
    mp[x - i] += x;
  }
  for (map<long long, long long>::iterator it = mp.begin(); it != mp.end();
       ++it) {
    ans = max(ans, it->second);
  }
  cout << ans << endl;
  return 0;
}
