#include <bits/stdc++.h>
using namespace std;
bool check_primt(int n);
bool check_palindrone(string b);
set<int> gen_factors(int a);
set<int> gen_primes(int a);
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long a;
  cin >> a;
  vector<long long> diff(600010, 0);
  vector<long long> b(a);
  for (int i = 1; i <= a; i++) {
    cin >> b[i - 1];
    diff[200000 + b[i - 1] - i] += b[i - 1];
  }
  long long ans = 0;
  for (int i = 0; i < diff.size(); i++) {
    if (ans < diff[i]) ans = diff[i];
  }
  cout << ans;
}
bool check_prime(int n) {
  if (n < 2) return 0;
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return 0;
  return 1;
}
bool check_palindrone(string b) {
  int length = b.length();
  for (int i = 0; i < (length + 1) / 2; i++) {
    if (b[i] != b[length - (i + 1)]) return false;
  }
  return true;
}
set<int> gen_factors(int a) {
  set<int> factors;
  for (int i = 1; i * i <= a; i++) {
    if (a % i == 0) {
      factors.insert(i);
      factors.insert(a / i);
    }
  }
  return factors;
}
set<int> gen_primes(int a) {
  set<int> primes;
  for (int i = 2; i <= a; i++) {
    if (check_prime(i)) primes.insert(i);
  }
  return primes;
}
