#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
int fx[] = {0, 0, +1, -1};
int fy[] = {+1, -1, 0, 0};
int x_move[] = {2, 1, -1, -2, -2, -1, 1, 2};
int y_move[] = {1, 2, 2, 1, -1, -2, -2, -1};
const int maX = 1e5 + 1;
long long dis[maX];
long long res[maX];
vector<long long> Graph[maX];
long long visit[maX];
long long cc = 0, l = 0;
vector<long long> p;
void solve() {
  long long n, i, j = -1, cc = 0;
  cin >> n;
  long long ara[n];
  map<long long, long long> check, bra;
  long long mx = -1;
  for (i = 0; i < n; i++) {
    cin >> j;
    check[i - j] += j;
    mx = max(mx, check[i - j]);
  }
  cout << mx << endl;
}
int main() {
  long long test;
  test = 1;
  while (test--) solve();
  return 0;
}
