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;
const int maxn = 2e+5 + 10;
int n, Xn, Yn, on;
int L[maxn], R[maxn];
bool vis[maxn];
struct op {
  int x, c;
} a[maxn];
struct node {
  int mx, mi;
  node() : mx(0), mi(0) {}
  set<int> S;
} nt[maxn << 3];
struct Segtree {
  int l, r, d;
  void up(int p, bool leaf) {
    if (!leaf) {
      nt[p].mx = max(nt[p << 1].mx, nt[p << 1 | 1].mx);
      nt[p].mi = min(nt[p << 1].mi, nt[p << 1 | 1].mi);
    } else
      nt[p].mx = nt[p].mi = 0;
    if (nt[p].S.size()) {
      nt[p].mx = max(nt[p].mx, *nt[p].S.rbegin());
      nt[p].mi = max(nt[p].mi, *nt[p].S.rbegin());
    }
    if (nt[p].mx < nt[p].mi || vis[nt[p].mx]) nt[p].mx = 0;
  }
  void modify(int p, int tl, int tr) {
    if (l <= tl && tr <= r) {
      if (d > 0)
        nt[p].S.insert(d);
      else
        nt[p].S.erase(-d);
      up(p, l == r - 1);
      return;
    }
    int mid = (tl + tr) >> 1;
    if (l < mid) modify(p << 1, tl, mid);
    if (mid < r) modify(p << 1 | 1, mid, tr);
    up(p, false);
  }
} T;
inline int read() {
  int x = 0, tg = 0;
  char c = getchar();
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') tg = 1;
  for (; c >= '0' && c <= '9'; c = getchar())
    x = (x << 3) + (x << 1) + (c ^ 48);
  return tg ? -x : x;
}
inline int mabs(int x) { return x < 0 ? -x : x; }
map<int, int> mpx, mpy;
map<int, int>::iterator mit;
bool cmpx(op aa, op bb) { return aa.x == bb.x ? aa.c > bb.c : aa.x < bb.x; }
void input() {
  int i;
  n = read();
  on = 0;
  for (i = 1; i <= n; i++) {
    a[on].x = read();
    L[i] = read();
    a[on + 1].x = read();
    R[i] = read();
    mpx[a[on].x] = mpx[a[on + 1].x] = mpy[L[i]] = mpy[R[i]] = 0;
    a[on].c = i;
    a[on + 1].c = -i;
    on += 2;
  }
  Xn = 1;
  for (mit = mpx.begin(); mit != mpx.end(); mit++) mit->second = Xn++;
  Yn = 1;
  for (mit = mpy.begin(); mit != mpy.end(); mit++) mit->second = Yn++;
  for (i = 0; i < on; i++) a[i].x = mpx[a[i].x];
  for (i = 1; i <= n; i++) L[i] = mpy[L[i]], R[i] = mpy[R[i]];
  sort(a, a + on, cmpx);
}
void solve() {
  int i, d, ans = 0;
  for (i = 0; i < on; i++) {
    if (i && a[i].x != a[i - 1].x)
      while (nt[1].mx) {
        vis[d = nt[1].mx] = true;
        ans++;
        T.l = L[d];
        T.r = R[d];
        T.d = 0;
        T.modify(1, 0, maxn);
      }
    d = mabs(a[i].c);
    T.l = L[d];
    T.r = R[d];
    T.d = a[i].c;
    T.modify(1, 0, maxn);
  }
  while (nt[1].mx) {
    vis[d = nt[1].mx] = true;
    ans++;
    T.l = L[d];
    T.r = R[d];
    T.d = 0;
    T.modify(1, 0, maxn);
  }
  printf("%d\n", ans + 1);
}
int main() {
  input();
  solve();
  return 0;
}
