#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long double EPS = 1e-9;
int n;
vector<int> a;
vector<int> b;
void solve() {
  cin >> n;
  map<long long int, vector<long long int>> m;
  a.resize(n + 1);
  b.resize(n + 1);
  for (long long int i = 0; i < (n); ++i) {
    cin >> a[i + 1];
    b[i + 1] = a[i + 1];
    a[i + 1] = a[i + 1] - i + 1;
  }
  for (long long int i = 1; i <= n; ++i) {
    m[a[i]].push_back(b[i]);
  }
  long long int ans = LONG_LONG_MIN;
  for (auto vals : m) {
    long long int sum = 0;
    for (auto bs : vals.second) {
      sum += bs;
    }
    ans = max(ans, sum);
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int test_Cases = 1;
  while (test_Cases--) {
    solve();
  }
}
