#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int N = 100005 * 6;
const int M = 100005 * 4;
int n, x;
long long c[N], ans;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    c[i - x + M] += x;
    ans = max(ans, c[i - x + M]);
  }
  cout << ans << "\n";
  return 0;
}
