#include <bits/stdc++.h>
using namespace std;
long long exp(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long r = pow(a, b / 2);
  if (b & 1) return r * a * r;
  return r * r;
}
int main() {
  long long n;
  cin >> n;
  long long a[n];
  map<long long, long long> m;
  for (auto i = 0; i < n; i += 1) {
    cin >> a[i];
  }
  for (auto i = 0; i < n; i += 1) {
    m[a[i] - i] += a[i];
  }
  long long ans = 0;
  for (auto i : m) {
    ans = max(ans, i.second);
  }
  cout << ans;
  return 0;
}
