#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, ans = 0;
  cin >> n;
  int b[n + 1];
  map<int, long long int> mp;
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    mp[b[i] - i] += b[i];
    ans = max(ans, mp[b[i] - i]);
  }
  cout << ans;
}
