#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long long> g(n);
  map<long long, long long> s;
  int jt = 0;
  for (auto it = g.begin(); it != g.end(); ++it) cin >> (*it);
  for (auto it = 0; it < g.size(); ++it) s[g[jt]] = 0;
  for (auto it = g.begin(); it != g.end(); ++it) {
    (*it) -= jt;
    s[g[jt]] += g[jt] + jt;
    ++jt;
  }
  long long max = 0;
  for (auto it = 0; it < g.size(); ++it) {
    if (max < s[g[it]]) max = s[g[it]];
  }
  cout << max;
}
