#include <bits/stdc++.h>
#pragma GCC optimize("-O2")
using namespace std;
const int N = 2e5 + 5, MOD = 1e9 + 7;
const long double EPS = 1e-9;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long i, n;
  long long ans = 0;
  cin >> n;
  long long a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  pair<long long, long long> b[n];
  for (i = 0; i < n; i++) {
    b[i].first = a[i] - i;
    b[i].second = i;
  }
  sort(b, b + n);
  ans = -1;
  long long temp = 0;
  for (i = 0; i < n; i++) {
    temp = a[b[i].second];
    while (i < n - 1 and b[i].first == b[i + 1].first) {
      temp += a[b[i + 1].second];
      i++;
    }
    ans = max(ans, temp);
  }
  cout << ans;
  return 0;
}
