#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
int n;
long long ans, a[MAXN];
map<int, long long> cnt;
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
  for (register int i = 1; i <= n; ++i) a[i] -= i;
  for (register int i = 1; i <= n; ++i) cnt[a[i]] += a[i] + i;
  for (register int i = -400000; i <= 400000; ++i) ans = max(ans, cnt[i]);
  printf("%lld\n", ans);
  return 0;
}
