#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 7;
struct NODE {
  int b, dt;
} a[MAXN];
int n;
long long ans, sum;
bool CMP(NODE x, NODE y) { return x.dt < y.dt; }
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i].b, a[i].dt = a[i].b - i;
  sort(a + 1, a + n + 1, CMP);
  for (int i = 1; i <= n; i++) {
    if (a[i].dt != a[i - 1].dt)
      sum = a[i].b;
    else
      sum += a[i].b;
    ans = max(ans, sum);
  }
  cout << ans << endl;
  return 0;
}
