#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
int a[1000100], b[1000100];
int n;
inline void Main() {
  cin >> n;
  int x;
  map<long long, long long> mp;
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    mp[x - i] += x;
    ans = max(ans, mp[x - i]);
  }
  cout << ans << endl;
}
int main() {
  Main();
  return 0;
}
