#include <bits/stdc++.h>
using namespace std;
const int MAXN = 302020;
int b[MAXN], n;
map<int, long long> mp;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &b[i]);
    mp[b[i] - i] += b[i];
  }
  long long ans = 0;
  for (auto g : mp) ans = max(ans, g.second);
  printf("%lld\n", ans);
  return 0;
}
