#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, a;
  cin >> n;
  map<long long, long long> mp;
  for (long long i = 1; i <= n; i++) {
    cin >> a;
    mp[a - i] += a;
  }
  long long mx = 0;
  for (auto x : mp) {
    mx = max(mx, x.second);
  }
  cout << mx << "\n";
}
