Arkady has got an infinite plane painted in color 0. Then he draws n rectangles filled with paint with sides parallel to the Cartesian coordinate axes, one after another. The color of the i-th rectangle is i (rectangles are enumerated from 1 to n in the order he draws them). It is possible that new rectangles cover some of the previous ones completely or partially.

Count the number of different colors on the plane after Arkady draws all the rectangles.

Input

The first line contains a single integer n (1 ≤ n ≤ 100 000) — the number of rectangles.

The i-th of the next n lines contains 4 integers x_1, y_1, x_2 and y_2 (-10^9 ≤ x_1 < x_2 ≤ 10^9, -10^9 ≤ y_1 < y_2 ≤ 10^9) — the coordinates of corners of the i-th rectangle.

Output

In the single line print the number of different colors in the plane, including color 0.

Examples

Input

5
-1 -1 1 1
-4 0 0 4
0 0 4 4
-4 -4 0 0
0 -4 4 0


Output

5

Input

4
0 0 4 4
-4 -4 0 0
0 -4 4 0
-2 -4 2 4


Output

5

Note

<image> That's how the plane looks in the first sample

<image> That's how the plane looks in the second sample

0 = white, 1 = cyan, 2 = blue, 3 = purple, 4 = yellow, 5 = red. 
#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T qmin(const T &x, const T &y) {
  return x < y ? x : y;
}
template <typename T>
inline T qmax(const T &x, const T &y) {
  return x > y ? x : y;
}
template <typename T>
inline void getmin(T &x, const T &y) {
  if (y < x) x = y;
}
template <typename T>
inline void getmax(T &x, const T &y) {
  if (y > x) x = y;
}
inline void fileio(const string &s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
const int inf = (int)1e9 + 7;
const long long linf = (long long)1e18 + 7;
const int N = 8e5 + 7;
set<int> s[N];
int mn[N], mx[N], ul[N], ur[N];
bool can[N];
int n, x1[N], x2[N], y233333[N], y2[N];
int nums[N], sz;
struct event {
  int p, l, r, v, tp;
  inline event() {}
  inline event(const int &_p, const int &_l, const int &_r, const int &_v,
               const int &_t)
      : p(_p), l(_l), r(_r), v(_v), tp(_t) {}
  inline bool operator<(const event &b) const {
    return p < b.p || p == b.p && tp < b.tp;
  }
} ev[N];
int cnt;
inline void upd(int u) {
  int v = *s[u].rbegin();
  if (ul[u] == ur[u]) {
    mn[u] = v;
    mx[u] = (can[v] ? 0 : v);
  } else if (v > qmin(mn[((u) << 1)], mn[((u) << 1 ^ 1)])) {
    mn[u] = v;
    mx[u] = qmax(v, qmax(mx[((u) << 1)], mx[((u) << 1 ^ 1)]));
    if (can[mx[u]]) mx[u] = 0;
  } else {
    mn[u] = qmin(mn[((u) << 1)], mn[((u) << 1 ^ 1)]);
    mx[u] = qmax(mx[((u) << 1)], mx[((u) << 1 ^ 1)]);
  }
}
inline void init(int u, int l, int r) {
  s[u].insert(0);
  ul[u] = l, ur[u] = r;
  if (l != r) {
    int mid = l + r >> 1;
    init(((u) << 1), l, mid);
    init(((u) << 1 ^ 1), mid + 1, r);
  }
  upd(u);
}
inline void ins(int u, int l, int r, int v) {
  if (l <= ul[u] && ur[u] <= r) {
    s[u].insert(v);
  } else {
    if (l <= ur[((u) << 1)]) ins(((u) << 1), l, r, v);
    if (r >= ul[((u) << 1 ^ 1)]) ins(((u) << 1 ^ 1), l, r, v);
  }
  upd(u);
}
inline void del(int u, int l, int r, int v) {
  if (l <= ul[u] && ur[u] <= r) {
    s[u].erase(v);
  } else {
    if (l <= ur[((u) << 1)]) del(((u) << 1), l, r, v);
    if (r >= ul[((u) << 1 ^ 1)]) del(((u) << 1 ^ 1), l, r, v);
  }
  upd(u);
}
int main() {
  scanf("%d", &n);
  for (register int i = (1); i <= (n); ++i) {
    scanf("%d%d%d%d", x1 + i, y233333 + i, x2 + i, y2 + i);
    nums[++sz] = y233333[i];
    nums[++sz] = y2[i];
  }
  sort(nums + 1, nums + sz + 1);
  sz = unique(nums + 1, nums + sz + 1) - nums - 1;
  for (register int i = (1); i <= (n); ++i) {
    y233333[i] = lower_bound(nums + 1, nums + sz + 1, y233333[i]) - nums;
    y2[i] = lower_bound(nums + 1, nums + sz + 1, y2[i]) - nums;
    ev[++cnt] = event(x1[i], y233333[i], y2[i] - 1, i, 1);
    ev[++cnt] = event(x2[i], y233333[i], y2[i] - 1, i, -1);
  }
  can[0] = true;
  init(1, 1, sz);
  sort(ev + 1, ev + cnt + 1);
  for (register int i = (1); i <= (cnt); ++i) {
    event &cur = ev[i];
    if (cur.tp == -1) {
      del(1, cur.l, cur.r, cur.v);
    } else if (cur.tp == 1) {
      ins(1, cur.l, cur.r, cur.v);
    } else
      assert(false);
    if (i == cnt || ev[i + 1].p != cur.p) {
      while (mx[1]) {
        int id = mx[1];
        can[id] = true;
        ins(1, y233333[id], y2[id] - 1, id);
        assert(mx[1] != id);
      }
    }
  }
  int ans = 1;
  for (register int i = (1); i <= (n); ++i) ans += can[i];
  printf("%d\n", ans);
  return 0;
}
