#include <bits/stdc++.h>
using namespace std;
const long long int N = 200005;
const long long int mod = 998244353;
void flash() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.setf(ios::showpoint);
  cout.precision(9);
}
string s;
void solve();
void change(long long int i) {
  if (i + 1 < s.length()) {
    if (s[i] == 'G') {
      if (s[i + 1] == 'G') s[i] = 'B';
    } else if (s[i] == 'B') {
      if (s[i + 1] == 'B') s[i] = 'R';
    } else if (s[i] == 'R') {
      if (s[i + 1] == 'R') s[i] = 'G';
    }
  }
}
int32_t main() {
  flash();
  long long int t;
  t = 1;
  while (t--) solve();
  return 0;
}
void solve() {
  long long int n;
  cin >> n;
  map<long long int, long long int> m;
  long long int x;
  long long int ans = INT32_MIN;
  for (long long int i = 0; i < n; i++) {
    cin >> x;
    m[i - x] += x;
    ans = max(ans, m[i - x]);
  }
  cout << ans << "\n";
  return;
}
