#include <bits/stdc++.h>
template <class C, class E>
inline bool contains(const C& container, const E& element) {
  return container.find(element) != container.end();
}
template <class T>
inline void checkmin(T& a, T b) {
  if (b < a) a = b;
}
template <class T>
inline void checkmax(T& a, T b) {
  if (b > a) a = b;
}
using namespace std;
int totalCases, theCase;
void Solve() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << std::setprecision(15);
  cout << std::fixed;
  int n;
  cin >> n;
  vector<long long> d(n);
  vector<long long> offset(2 * 800100);
  for (int i = (0), _b = ((n)-1); i <= _b; i++) cin >> d[i];
  long long best = 0;
  for (int i = (0), _b = ((n)-1); i <= _b; i++) {
    int off = i - d[i];
    offset[off + 800100] += d[i];
    checkmax(best, offset[off + 800100]);
  }
  cout << best;
  return 0;
}
