#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
long long a[650005], ans = 0;
int main() {
  int n, x;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    scanf("%d", &x), a[x - i + N] += x, ans = max(ans, a[x - i + N]);
  cout << ans;
}
