#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b) { return b ? GCD(b, a % b) : a; }
long long LCM(long long a, long long b) { return a * b / GCD(a, b); }
const int N = 2e5 + 7;
const int mod = 1e9 + 7;
const long long inf = 1e18 + 7;
long long n;
long long a[N];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], a[i] -= i;
  map<long long, long long> mp;
  for (int i = 1; i <= n; i++) mp[a[i]] += a[i] + i;
  long long ans = 0;
  for (auto& i : mp) ans = max(ans, i.second);
  cout << ans << "\n";
  return 0;
}
