#include <bits/stdc++.h>
using namespace std;
long long int n, a[200005];
long long maxn = -1, d[1000005];
int main() {
  scanf("%lld", &n);
  for (long long int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  for (int i = 0; i < n; i++) a[i] = a[i] - i + n;
  for (int i = 0; i < n; i++) d[a[i]] += a[i] + i - n;
  for (int i = 0; i < 1000000; i++) maxn = max(maxn, d[i]);
  printf("%lld\n", maxn);
  return 0;
}
