#include <bits/stdc++.h>
using namespace std;
int nCrModpDP(long long int n, long long int r, long long int p) {
  long long int C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long int i = 1; i <= n; i++) {
    for (long long int j = min(i, r); j > 0; j--) C[j] = (C[j] + C[j - 1]) % p;
  }
  return C[r];
}
long long int ncr(long long int n, long long int r, long long int p) {
  if (r == 0) return 1;
  long long int ni = n % p, ri = r % p;
  return (ncr(n / p, r / p, p) * nCrModpDP(ni, ri, p)) % p;
}
long long int power(long long int x, long long int n) {
  if (n == 0)
    return 1;
  else if (n == 1)
    return x;
  else if (n % 2 == 0)
    return (power(x, n / 2) % 1000000007 * power(x, n / 2) % 1000000007) %
           1000000007;
  else
    return (x % 1000000007 *
            ((power(x, (n - 1) / 2) % 1000000007 * power(x, (n - 1) / 2) %
              1000000007) %
             1000000007) %
            1000000007) %
           1000000007;
}
long long int isprime(long long int n) {
  long long int i;
  for (i = 2; i <= (long long int)sqrt(n); i++) {
    if (n % i == 0) return 0;
  }
  return 1;
}
int main() {
  long long int n, i, j, temp = 0, ans = -1 * 1000000007;
  cin >> n;
  long long int arr[n], arr1[n];
  for (i = 0; i < n; i++) cin >> arr[i];
  map<long long int, long long int> mp;
  for (i = 0; i < n; i++) arr1[i] = arr[i] - i;
  for (i = 0; i < n; i++) mp[arr1[i]] += arr[i];
  map<long long int, long long int>::iterator itr;
  for (itr = mp.begin(); itr != mp.end(); itr++) {
    if (itr->second > ans) ans = itr->second;
  }
  cout << ans << '\n';
  return 0;
}
