#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
	vector<int> arr(n);
	for(int i = 0; i < n; i++){
		cin >> arr[i];
	}
	vector<int> temp(n);
	for(int i = 0; i < n; i++)
	temp[i] = arr[i]-i;
	
	unordered_map<int,int> mp;
	for(int i = 0; i < n; i++){
		mp[temp[i]] += arr[i];
	}
	int res = INT_MIN;
	for(auto it : mp){
		int val = it.second;
		res = max(res, val);
	}
	cout << res;
	return 0;
}