#include <bits/stdc++.h>
using namespace std;
template <typename T>
void write(vector<T> &a) {
  for (auto it = a.begin(); it != a.end(); it++) cout << *it << " ";
  cout << endl;
}
void random(int a, int b, int n) {
  srand(time(0));
  for (int i = 0; i < n; i++) cout << rand() % b + a << " ";
  cout << endl;
}
long long int max(long long int a, long long int b) { return (a > b) ? a : b; }
long long int min(long long int a, long long int b) { return (a < b) ? a : b; }
bool isPrime(long long int n) {
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << setprecision(15);
  {
    long long int n;
    cin >> n;
    vector<long long int> arr(n);
    for (auto &a : arr) cin >> a;
    map<long long int, long long int> cnt;
    for (int i = 0; i < n; i++) {
      cnt[arr[i] - i] += arr[i];
    }
    long long int maxima = INT_MIN;
    for (auto a : cnt) maxima = max(maxima, a.second);
    cout << maxima << endl;
  }
  return 0;
}
