#include <bits/stdc++.h>
using namespace std;
const int mx = (int)2e5 + 1;
const long long infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const int64_t INF = 1e17;
long long powm(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
long long power(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a);
    a = (a * a);
    b >>= 1;
  }
  return res;
}
double nthRoot(long long A, long long N) {
  double xPre = rand() % 10;
  double eps = 1e-3;
  double delX = INT_MAX;
  double xK;
  while (delX > eps) {
    xK = ((N - 1.0) * xPre + (double)A / pow(xPre, N - 1)) / (double)N;
    delX = abs(xK - xPre);
    xPre = xK;
  }
  return xK;
}
long long divide(long long a, long long b) {
  return (a % mod) * powm(b, mod - 2) % mod;
}
long long mulm(long long a, long long b) {
  return ((a % mod) * (b % mod)) % mod;
}
long long addm(long long a, long long b) { return (a % mod + b % mod) % mod; }
inline int64_t mul(int64_t a, int64_t b) { return (INF / a > b ? a * b : INF); }
inline int64_t add(int64_t a, int64_t b) {
  return (a + b >= INF ? INF : a + b);
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long extgcd(long long a, long long b, long long& x, long long& y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long x1, y1;
  long long d = extgcd(b, a % b, x1, y1);
  x = y1;
  y = x1 - y1 * (a / b);
  return d;
}
long long fact[mx];
long long nCr(long long n, long long r) {
  if (r > n || r < 0) return 0;
  long long z = fact[n];
  z = mul(z, powm(fact[n - r], mod - 2));
  z = mul(z, powm(fact[r], mod - 2));
  return z;
}
bool cmpd(pair<long long, long long> a, pair<long long, long long> b) {
  return a.second > b.second;
}
bool cmpa(pair<long long, long long> a, pair<long long, long long> b) {
  return a.second < b.second;
}
vector<long long> g[mx];
bool vis[mx];
void solve() {
  long long n;
  cin >> n;
  long long city[n + 1];
  std::map<long long, long long> t;
  for (long long i = 1; i < n + 1; i++) {
    cin >> city[i];
    t[city[i] - i] = t[city[i] - i] + city[i];
  }
  long long ans = 0;
  for (auto i = t.begin(); i != t.end(); i++) {
    ans = max(ans, i->second);
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
