#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
void c_p_c() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int gcd(int u, int v) {
  int shift;
  if (u == 0) return v;
  if (v == 0) return u;
  shift = __builtin_ctz(u | v);
  u >>= __builtin_ctz(u);
  do {
    v >>= __builtin_ctz(v);
    if (u > v) {
      int t = v;
      v = u;
      u = t;
    }
    v = v - u;
  } while (v != 0);
  return u << shift;
}
int rec(vector<long long> &arr, vector<int> &dp, int idx, int curr) {
  if (idx < 0) return 1;
  if (dp[idx] != -1) return dp[idx];
  int ans1 = 0, ans2 = 0;
  if (curr == -1) {
    ans1 = arr[idx] + rec(arr, dp, idx - 1, idx);
    ans2 = rec(arr, dp, idx - 1, -1);
  } else {
    if (idx - curr == arr[idx] - arr[curr]) {
      ans1 = arr[idx] + rec(arr, dp, idx - 1, idx);
    }
    ans2 = rec(arr, dp, idx - 1, curr);
  }
  dp[idx] = max(ans1, ans2);
  return dp[idx];
}
void test_case() {
  long long n;
  cin >> n;
  vector<long long> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  if (n == 1) {
    cout << arr[0] << '\n';
    return;
  }
  long long nax = INT_MIN;
  unordered_map<int, long long> map;
  for (int i = 0; i < n; i++) {
    map[i - arr[i]] += arr[i];
    nax = max(nax, map[i - arr[i]]);
  }
  cout << nax << '\n';
}
int main() {
  c_p_c();
  int tt = 1;
  for (int test = 1; test <= tt; test++) {
    test_case();
  }
  return 0;
}
