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;
char buf[1 << 21], *p1 = buf, *p2 = buf;
inline int read() {
  int s = 0, w = 1;
  char ch = getchar();
  while (ch < 48 || ch > 57) {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= 48 && ch <= 57)
    s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
  return s * w;
}
template <typename T>
inline void Max(T &a, T b) {
  if (a < b) a = b;
}
template <typename T>
inline void Min(T &a, T b) {
  if (a > b) a = b;
}
const int N = 2e5 + 7;
int n, ndc, vc, V[N], xl[N], xr[N], yl[N], yr[N];
int mx[N << 2], mi[N << 2];
bool vis[N];
struct qs {
  int p, l, r, opt;
  bool operator<(const qs &rhs) const {
    if (p != rhs.p) return p < rhs.p;
    return opt < rhs.opt;
  }
} q[N];
struct Heap {
  priority_queue<int> A, B;
  void ins(int x) { A.push(x); }
  void del(int x) { B.push(x); }
  inline int top() {
    while (!B.empty() && A.top() == B.top()) A.pop(), B.pop();
    return A.empty() ? 0 : A.top();
  }
} col[N << 2];
inline void pushup(int l, int r, int o) {
  if (l ^ r) {
    mi[o] = min(mi[o << 1], mi[o << 1 | 1]);
    mx[o] = max(mx[o << 1], mx[o << 1 | 1]);
  } else
    mi[o] = mx[o] = 0;
  if (col[o].top()) {
    int x = col[o].top();
    if (vis[x])
      Max(mi[o], x);
    else
      Max(mx[o], x);
    if (mi[o] > mx[o]) mx[o] = 0;
  }
}
void modify(int L, int R, int l, int r, int o, int v) {
  if (L <= l && r <= R) {
    if (v > 0) col[o].ins(v);
    if (v < 0) col[o].del(-v);
    pushup(l, r, o);
    return;
  }
  int mid = (l + r) >> 1;
  if (L <= mid) modify(L, R, l, mid, o << 1, v);
  if (R > mid) modify(L, R, mid + 1, r, o << 1 | 1, v);
  pushup(l, r, o);
}
signed main() {
  n = read();
  for (register int i = 1; i <= n; ++i) {
    xl[i] = read(), yl[i] = read();
    xr[i] = read(), yr[i] = read();
    q[++ndc] = (qs){xl[i], yl[i], yr[i] - 1, i};
    q[++ndc] = (qs){xr[i], yl[i], yr[i] - 1, -i};
    V[++vc] = yl[i];
    V[++vc] = yr[i];
  }
  sort(V + 1, V + vc + 1);
  sort(q + 1, q + ndc + 1);
  vc = unique(V + 1, V + vc + 1) - V - 1;
  for (register int i = 1; i <= n; ++i) {
    yl[i] = lower_bound(V + 1, V + vc + 1, yl[i]) - V;
    yr[i] = upper_bound(V + 1, V + vc + 1, yr[i] - 1) - V - 1;
  }
  for (register int i = 1; i <= ndc; ++i) {
    q[i].l = lower_bound(V + 1, V + vc + 1, q[i].l) - V;
    q[i].r = upper_bound(V + 1, V + vc + 1, q[i].r) - V - 1;
  }
  for (int i = 1, j = 1; i <= ndc; i = j) {
    for (; j <= ndc && q[j].p == q[i].p; ++j)
      modify(q[j].l, q[j].r, 1, vc, 1, q[j].opt);
    while (mx[1]) {
      int x = mx[1];
      vis[x] = 1;
      modify(yl[x], yr[x], 1, vc, 1, 0);
    }
  }
  int ans = 1;
  for (register int i = 1; i <= n; ++i)
    if (vis[i]) ++ans;
  cout << ans << endl;
  return 0;
}
