#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:5000000000")
const long long mod = 1000000007;
int Inf = (int)2e9;
long long LINF = (long long)1e18 + 1e17;
using namespace std;
void update(string &s, int pos) {
  int n = s.length();
  string t = s.substr(0, pos) + s.substr(pos + 1, n - pos - 1);
  s = t;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  map<long long, long long> cnt;
  for (int(i) = 0; (i) < n; (i)++) {
    long long x;
    cin >> x;
    cnt[x - i] += x;
  }
  long long ans = 0;
  for (auto(it) = (cnt).begin(); (it) != (cnt).end(); (it)++) {
    ans = max(ans, it->second);
  }
  cout << ans;
  return 0;
}
