#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18L + 5;
long long gcd(unsigned long long x, unsigned long long y) {
  if (x == 0) return y;
  return gcd(y % x, x);
}
long long gcdExtended(long long a, long long b, long long *x, long long *y) {
  if (a == 0) {
    *x = 0;
    *y = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = gcdExtended(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
unsigned long long findGCD(vector<unsigned long long> &v) {
  unsigned long long result = v[0];
  for (long long i = 1; i < v.size(); i++) {
    result = gcd(v[i], result);
    if (result == 1) {
      return 1;
    }
  }
  return result;
}
long long lcm(long long a, long long b) { return ((a * b) / gcd(a, b)); }
bool sortbysec(long long a, long long b) { return (a > b); }
vector<long long> primeFactors(long long n) {
  vector<long long> ans;
  while (n % 2 == 0) {
    ans.push_back(2);
    n = n / 2;
  }
  for (long long i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      ans.push_back(i);
      n = n / i;
    }
  }
  if (n > 2) ans.push_back(n);
  return ans;
}
vector<long long> all_prime(long long n) {
  vector<long long> sieve(n + 1, 0);
  for (long long x = 2; x <= n; x++) {
    if (sieve[x]) continue;
    for (int u = 2 * x; u <= n; u += x) {
      if (sieve[u] == 0) {
        sieve[u] = x;
      }
    }
  }
  return sieve;
}
long long power(long long x, long long n) {
  if (n == 0) return 1;
  long long temp = power(x, n / 2);
  if (n % 2 == 0)
    return temp * temp;
  else
    return x * temp * temp;
}
unsigned long long powerper(unsigned long long x, long long y, long long p) {
  unsigned long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
unsigned long long modInverse(unsigned long long n, long long p) {
  return powerper(n, p - 2, p);
}
unsigned long long nCrModPFermat(unsigned long long n, long long r, long long p,
                                 unsigned long long fac[]) {
  if (n < r) return 0;
  if (r == 0) return 1;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
void dfs(vector<vector<long long>> &v, vector<long long> &df, long long seen[],
         long long i) {
  df.push_back(i);
  for (long long j = 0; j < v[i].size(); j++) {
    if (seen[v[i][j]] == 0) {
      seen[v[i][j]] = seen[i];
      dfs(v, df, seen, v[i][j]);
    }
  }
}
bool BFS(vector<vector<long long>> &adj, long long src, long long dest,
         long long n, long long pred[], long long dist[]) {
  list<long long> queue;
  bool visited[n];
  for (long long i = 0; i < n; i++) {
    visited[i] = false;
    dist[i] = INF;
    pred[i] = -1;
  }
  visited[src] = true;
  dist[src] = 0;
  queue.push_back(src);
  while (!queue.empty()) {
    long long u = queue.front();
    queue.pop_front();
    for (long long i = 0; i < adj[u].size(); i++) {
      if (visited[adj[u][i]] == false) {
        visited[adj[u][i]] = true;
        dist[adj[u][i]] = dist[u] + 1;
        pred[adj[u][i]] = u;
        queue.push_back(adj[u][i]);
        if (adj[u][i] == dest) return true;
      }
    }
  }
  return false;
}
long long findConnComp(vector<vector<long long>> &v, long long seen[],
                       long long n) {
  long long j = 0;
  vector<long long> df;
  for (long long i = 0; i < n; i++) seen[i] = 0;
  for (long long i = 0; i < n; i++) {
    if (!seen[i]) {
      seen[i] = ++j;
      dfs(v, df, seen, i);
    }
  }
  return j;
}
vector<long long> dijkstra_set(vector<vector<pair<long long, long long>>> &adj,
                               long long src, long long V) {
  set<pair<long long, long long>> setds;
  vector<long long> dist(V, INF);
  setds.insert(make_pair(0LL, src));
  dist[src] = 0;
  vector<long long> parent(V);
  parent[src] = src;
  while (!setds.empty()) {
    pair<long long, long long> tmp = *(setds.begin());
    setds.erase(setds.begin());
    long long u = tmp.second;
    for (auto it = adj[u].begin(); it != adj[u].end(); it++) {
      long long v = (*it).first;
      long long weight = (*it).second;
      if (dist[v] > dist[u] + weight) {
        parent[v] = u;
        if (dist[v] != INF) setds.erase(setds.find(make_pair(dist[v], v)));
        dist[v] = dist[u] + weight;
        setds.insert(make_pair(dist[v], v));
      }
    }
  }
  return dist;
}
void printpath(vector<long long> &v1, long long dest) {
  if (v1[dest] == dest) {
    cout << dest << ' ';
    return;
  }
  printpath(v1, v1[dest]);
  cout << dest << ' ';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long a[n];
  long long b[n];
  map<long long, long long> m;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = i - a[i];
    m[b[i]] += a[i];
  }
  vector<long long> v;
  auto itr = m.begin();
  while (itr != m.end()) {
    v.push_back(itr->second);
    itr++;
  }
  sort(v.begin(), v.end(), greater<long long>());
  cout << v[0];
}
