#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
long long n;
long long b[maxn];
long long cnt[maxn * 5];
bool vis[maxn * 5];
int main() {
  long long ans = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    cnt[b[i] - i + maxn] += b[i];
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[b[i] - i + maxn]) {
      vis[b[i] - i + maxn] = 1;
      ans = max(ans, cnt[b[i] - i + maxn]);
    }
  }
  cout << ans << endl;
  return 0;
}
