#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<long long, long long>, vector<pair<long long, long long> >,
               greater<pair<long long, long long> > >
    pq;
priority_queue<long long, vector<long long>, greater<long long> > pq1;
int main() {
  if (fopen("input.txt", "r"))
    freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> arr(n);
  vector<long long> dp(n + 1, 0);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    dp[i] = 0;
  }
  long long p = 0;
  map<long long, long long> m;
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    m[i + 1 - arr[i]] += arr[i];
    ans = max(ans, m[i + 1 - arr[i]]);
  }
  cout << ans;
  return 0;
}
