#include <bits/stdc++.h>
using namespace std;
vector<long long> v[((long long)(2e6 + 100))];
long long a[((long long)(2e6 + 100))];
long long b[((long long)(2e6 + 100))];
long long n, m, k, p;
map<long long, long long> mp;
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> k;
    mp[k - i] += k;
  }
  long long pas = 0;
  for (auto x : mp) {
    pas = max(pas, x.second);
  }
  cout << pas;
}
