#include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
  if (a > b)
    return a;
  else
    return b;
}
long long min(long long a, long long b) {
  if (a < b)
    return a;
  else
    return b;
}
const long long inf = 0x3f3f3f3f;
void solve() {
  long long n, i, j;
  long long x = 0, x1;
  cin >> n;
  long long a[n];
  map<long long, vector<long long>> m;
  for (long long i = (0); i < (n); i++) {
    cin >> a[i];
    m[a[i] - i].emplace_back(a[i]);
  }
  for (auto it : m) {
    long long s1 = 0;
    for (auto it1 : it.second) s1 += it1;
    x = max(x, s1);
  }
  cout << x << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
