#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const double eps = 1e-9;
inline int read() {
  int ret = 0, sgn = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') sgn = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    ret = ret * 10 + ch - '0';
    ch = getchar();
  }
  return ret * sgn;
}
inline void Out(int a) {
  if (a > 9) Out(a / 10);
  putchar(a % 10 + '0');
}
long long __gcd(long long a, long long b) {
  return b == 0 ? a : __gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a * b / __gcd(a, b); }
long long qpow(long long x, long long n, long long mod) {
  if (n == 0) return 1;
  long long res = qpow((x * x) % mod, n / 2, mod) % mod;
  if (n & 1) res = (res * x) % mod;
  return res % mod;
}
int Fermat(int a, int p) { return qpow(a, p - 2, p); }
long long exgcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long g = exgcd(b, a % b, x, y);
  long long t = x;
  x = y;
  y = t - a / b * y;
  return g;
}
const int N = 4e5 + 10;
const int inf = 0x7ffffff;
int n, m;
int res, tmp;
map<int, long long> mp;
int b[N];
int main() {
  scanf("%d", &n);
  mp.clear();
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &b[i]);
    mp[b[i] - i] += b[i];
    ans = max(ans, mp[b[i] - i]);
  }
  printf("%lld\n", ans);
  return 0;
}
