#include <bits/stdc++.h>
using namespace std;
const int mxa = 2e5 + 5;
int n;
long long b[mxa], ans;
map<int, long long> m;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    m[b[i] - i] += b[i];
  }
  for (auto it : m) ans = max(ans, it.second);
  cout << ans << "\n";
}
