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 N = 1e5 + 10;
struct Event {
  int x, id, typ;
  Event() {}
  Event(const int &_x, const int &_i, const int &_t) : x(_x), id(_i), typ(_t) {}
  bool operator<(const Event &b) const {
    if (x ^ b.x) return x < b.x;
    return typ < b.typ;
  }
} ev[N << 1];
bool vis[N];
struct SegTree {
  set<int> cur[N << 2];
  int mn[N << 2], mx[N << 2];
  void pushUp(const int &le, const int &ri) {
    int u = (((le) + (ri)) | ((le) != (ri)));
    if (le < ri) {
      int mi = (le + ri) >> 1;
      mn[u] = min(mn[(((le) + (mi)) | ((le) != (mi)))],
                  mn[(((mi + 1) + (ri)) | ((mi + 1) != (ri)))]);
      mx[u] = max(mx[(((le) + (mi)) | ((le) != (mi)))],
                  mx[(((mi + 1) + (ri)) | ((mi + 1) != (ri)))]);
    } else
      mn[u] = mx[u] = 0;
    if (!cur[u].empty()) {
      int it = *cur[u].rbegin();
      mn[u] = max(mn[u], it);
      if (it < mx[u]) return;
      if (it < mn[u] || vis[it])
        mx[u] = 0;
      else
        mx[u] = it;
    }
    assert(!mx[u] || mx[u] >= mn[u]);
  }
  void modify(const int &le, const int &ri, const int &ql, const int &qr,
              const int &id, const int &typ) {
    if (ql <= le && ri <= qr) {
      if (typ == 1)
        cur[(((le) + (ri)) | ((le) != (ri)))].insert(id);
      else
        cur[(((le) + (ri)) | ((le) != (ri)))].erase(id);
      pushUp(le, ri);
      return;
    }
    int mi = (le + ri) >> 1;
    if (ql <= mi) modify(le, mi, ql, qr, id, typ);
    if (mi < qr) modify(mi + 1, ri, ql, qr, id, typ);
    pushUp(le, ri);
  }
  void update(const int &le, const int &ri, const int &ql, const int &qr) {
    if (ql <= le && ri <= qr) {
      pushUp(le, ri);
      return;
    }
    int mi = (le + ri) >> 1;
    if (ql <= mi) update(le, mi, ql, qr);
    if (mi < qr) update(mi + 1, ri, ql, qr);
    pushUp(le, ri);
  }
  int fetchMax(const int &le, const int &ri) {
    return mx[(((le) + (ri)) | ((le) != (ri)))];
  }
} se;
int n;
vector<int> uniy;
int bon[N][2];
inline int rin(int &r) {
  int b = 1, c = getchar();
  r = 0;
  while (c < '0' || '9' < c) b = c == '-' ? -1 : b, c = getchar();
  while ('0' <= c && c <= '9') r = (r * 10) + (c ^ '0'), c = getchar();
  return r *= b;
}
int main() {
  rin(n);
  for (int i = 1; i <= n; i++) {
    int vl, vr, vd, vu;
    rin(vl), rin(vd), rin(vr), rin(vu);
    bon[i][0] = vd, bon[i][1] = vu;
    ev[i * 2 - 1] = Event(vl, i, 1);
    ev[i * 2] = Event(vr, i, -1);
    uniy.push_back(vu), uniy.push_back(vd);
  }
  sort(ev + 1, ev + 1 + 2 * n);
  sort(uniy.begin(), uniy.end());
  uniy.erase(unique(uniy.begin(), uniy.end()), uniy.end());
  for (int i = 1; i <= n; i++) {
    bon[i][0] = (int)(lower_bound(uniy.begin(), uniy.end(), bon[i][0]) -
                      uniy.begin() + 1);
    bon[i][1] = (int)(lower_bound(uniy.begin(), uniy.end(), bon[i][1]) -
                      uniy.begin() + 1) -
                1;
  }
  int m = (int)uniy.size(), ans = 0;
  for (int i = 1; i <= n * 2; i++) {
    int ii = i, tmp;
    while (ii < n * 2 && ev[ii + 1].x == ev[i].x) ii++;
    for (int j = i; j <= ii; j++) {
      int id = ev[j].id;
      se.modify(1, m, bon[id][0], bon[id][1], id, ev[j].typ);
    }
    i = ii;
    while ((tmp = se.fetchMax(1, m)) > 0) {
      ans++, vis[tmp] = true;
      se.update(1, m, bon[tmp][0], bon[tmp][1]);
    }
  }
  printf("%d\n", ans + 1);
  return 0;
}
