#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const int MAXN = (int)4e5 + 5;
const int MOD = (int)1e9 + 7;
const int INF = 0x3f3f3f3f;
const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, -1, 1};
long long a, x;
map<int, long long> dp;
bool cmp(pair<int, long long> a, pair<int, long long> b) {
  return a.second < b.second;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    x = a - i;
    dp[x] += a;
  }
  cout << max_element(dp.begin(), dp.end(), cmp)->second << endl;
  return 0;
}
