#include <bits/stdc++.h>
using namespace std;
const int mxn = 600010;
int a[mxn], n;
long long c[mxn];
int main() {
  memset(c, 0, sizeof(c));
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    c[a[i] - i + n] += a[i];
  }
  long long ans = 0;
  for (int i = 0; i < mxn; i++) ans = max(ans, c[i]);
  cout << ans << "\n";
  return 0;
}
