#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using point = pair<int, int>;
const int N = 2e5;
int n;
vector<ll> ans;
point arr[N];
int main() {
  ios_base::sync_with_stdio();
  cin.tie(0);
  cout.tie(0);
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &arr[i].second);
    arr[i].first = arr[i].second - (i + 1);
  }
  sort(arr, arr + n);
  int elem = arr[0].first, idx = 0;
  ll sum = 0;
  while (idx < n) {
    if (arr[idx].first == elem) {
      sum += arr[idx++].second;
    } else {
      ans.emplace_back(sum);
      sum = 0;
      elem = arr[idx].first;
    }
  }
  ans.emplace_back(sum);
  sort(ans.begin(), ans.end());
  printf("%lld", ans.back());
}
