#include <bits/stdc++.h>
using namespace std;
double pi = acos(-1);
const int MOD = 1000000007;
void OJ() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
}
vector<long long> inp;
map<long long, vector<long long>> adj;
int main() {
  OJ();
  clock_t clk = clock();
  long long n, ans = -1;
  cin >> n;
  inp = vector<long long>(n);
  for (long long i = 0; i < n; i++) cin >> inp[i];
  for (long long i = 0; i < n; i++) {
    adj[inp[i] - i].push_back(i);
  }
  for (auto i : adj) {
    long long temp = 0;
    for (auto j : i.second) temp += inp[j];
    ans = max(ans, temp);
  }
  cout << ans;
  clk = clock() - clk;
  cerr << "Time Elapsed: " << fixed << setprecision(10)
       << ((long double)clk) / CLOCKS_PER_SEC << "\n";
}
