#include <bits/stdc++.h>
const int mod = 1e9 + 7;
const int M = 4e5 + 5;
const int N = 8e5 + 10;
using namespace std;
inline long long read() {
  long long sum = 0, b = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') b = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    sum = sum * 10 + c - '0';
    c = getchar();
  }
  return b * sum;
}
int t, n, m, k;
long long ans, a[M], vis[N + 1];
int main() {
  int i, j;
  n = read();
  for (i = 1; i <= n; i++) {
    long long x = read();
    vis[x - i + M] += x;
  }
  for (i = 1; i <= N; i++) {
    ans = max(ans, vis[i]);
  }
  printf("%lld", ans);
  return 0;
}
