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