#include <bits/stdc++.h>
const int mod = 1e9 + 7;
const int maxn = 2e5 + 5;
const int INF = 1e8;
using namespace std;
int min_self(int &a, int b) { a = min(a, b); }
int max_self(int &a, int b) { a = max(a, b); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  while (t--) {
    int n;
    cin >> n;
    vector<int> arr(n);
    map<long long int, long long int> mp;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
      mp[i - arr[i]] = (arr[i] + mp[i - arr[i]]);
    }
    long long int ans = 0;
    for (auto it : mp) ans = max(ans, it.second);
    cout << ans << '\n';
  }
  return 0;
}
