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