#include <bits/stdc++.h>
using namespace std;
long long dx[] = {0, -1, 0, 1};
long long dy[] = {1, 0, -1, 0};
const long long mod = 1e9 + 7;
long long i, j;
long long add(long long a, long long b) {
  return ((a % mod) + (b % mod) + mod) % mod;
}
long long mul(long long a, long long b) {
  return ((a % mod) * (b % mod) + mod) % mod;
}
void pause(long long id) {
  cout << "Waiting " << id << endl;
  cin >> id;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  long long n;
  cin >> n;
  long long b[n];
  long long i, j;
  for (i = 0; i < n; i++) {
    cin >> b[i];
  }
  long long ans;
  long long a[n];
  for (i = 0; i < n; i++) {
    a[i] = b[i] - i;
  }
  unordered_map<long long, long long> mp;
  for (i = 0; i < n; i++) {
    mp[a[i]] += b[i];
  }
  long long mx = -1;
  for (auto c : mp) {
    mx = max(mx, c.second);
  }
  cout << mx << endl;
  return 0;
}
