#include <bits/stdc++.h>
using namespace std;
long long b[200010];
long long dp[200010];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    dp[i] = b[i] - i;
  }
  map<int, long long> summation;
  for (int i = 0; i < n; i++) {
    summation[dp[i]] += b[i];
  }
  long long result = -999;
  for (auto i = summation.begin(); i != summation.end(); i++) {
    result = max(result, (*i).second);
  }
  cout << result << endl;
}
