Mr. Chanek gives you a sequence a indexed from 1 to n. Define f(a) as the number of indices where a_i = i. 

You can pick an element from the current sequence and remove it, then concatenate the remaining elements together. For example, if you remove the 3-rd element from the sequence [4, 2, 3, 1], the resulting sequence will be [4, 2, 1]. 

You want to remove some elements from a in order to maximize f(a), using zero or more operations. Find the largest possible f(a).

Input

The first line contains one integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the initial length of the sequence.

The second line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 2 ⋅ 10^5) — the initial sequence a.

Output

Output an integer denoting the largest f(a) that can be obtained by doing zero or more operations.

Examples

Input


7
2 1 4 2 5 3 7


Output


3


Input


4
4 2 3 1


Output


2

Note

In the first example, f(A) = 3 by doing the following operations.

[2,1,4,2,5,3,7] → [2,1,2,5,3,7] → [1,2,5,3,7] → [1,2,5,3] → [1,2,3]

In the second example, f(A) = 2 and no additional operation is needed.
#include <bits/stdc++.h>
using namespace std;
template <class E_T, class C_T, C_T n_inf, class R_T>
struct BIT {
  vector<C_T> pos;
  vector<E_T> elems;
  bool act = false;
  BIT() { pos.push_back(n_inf); }
  void init() {
    if (act) {
      for (E_T &c_elem : elems) c_elem.init();
    } else {
      act = true;
      sort(pos.begin(), pos.end());
      pos.resize(unique(pos.begin(), pos.end()) - pos.begin());
      elems.resize(pos.size());
    }
  }
  template <typename... loc_form>
  void update(C_T cx, loc_form... args) {
    if (act) {
      int x = lower_bound(pos.begin(), pos.end(), cx) - pos.begin();
      for (; x < (int)pos.size(); x += x & -x) elems[x].update(args...);
    } else {
      pos.push_back(cx);
    }
  }
  template <typename... loc_form>
  R_T query(C_T cx, loc_form... args) {
    R_T res = 0;
    int x = lower_bound(pos.begin(), pos.end(), cx) - pos.begin() - 1;
    for (; x > 0; x -= x & -x) res += elems[x].query(args...);
    return res;
  }
};
template <typename I_T>
struct wrapped {
  I_T a = 0;
  void update(I_T b) { a = max(a, b); }
  I_T query() { return a; }
  void init() {}
  void update() {}
};
const int MAX_N = 2e5 + 5;
int arr[MAX_N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    arr[i] = i - arr[i];
  }
  BIT<BIT<wrapped<int>, int, INT_MIN, int>, int, INT_MIN, int> dp;
  for (int k = 0; k < 2; k++) {
    for (int i = 1; i <= n; i++) {
      if (arr[i] < 0) continue;
      dp.update(1 + arr[i], 1 + i - arr[i]);
    }
    dp.init();
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (arr[i] < 0) continue;
    int cur = 1 + dp.query(1 + 1 + arr[i], 1 + i - arr[i]);
    dp.update(1 + arr[i], 1 + i - arr[i], cur);
    ans = max(ans, cur);
  }
  cout << ans << endl;
}
