//
// Created by 曾仕邦 on 2021/7/19.
//
#include "bits/stdc++.h"
using namespace std;
bool cmp(long long a,long long b){
return a>b;
}
int main(){
int n;cin>>n;
long long ans[1000100]={0};
for (int i = 1; i <= n; ++i) {
int temp; scanf("%d",&temp);
ans[temp-i+500100] += temp;
}
long long res=0;
sort(ans,ans+1000100,cmp);
cout<<ans[0];
}