#include <bits/stdc++.h>
using namespace std;
int dcmp(double x, double y) {
  return fabs(x - y) <= 1e-9 ? 0 : x < y ? -1 : 1;
}
const int MAX = 2 * 1e5 + 1;
map<long long, long long> mp;
int n;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n;
  for (int i = 0; i < (int)(n); ++i) {
    int tmp;
    cin >> tmp;
    mp[i + 1 - tmp] += tmp;
  }
  long long ans = 0;
  for (auto x : mp) {
    ans = max(ans, x.second);
  }
  cout << ans << '\n';
}
