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 INF = 0x3fffffff;
const int SINF = 0x7fffffff;
const long long LINF = 0x3fffffffffffffff;
const long long SLINF = 0x7fffffffffffffff;
const int MAXN = 200007;
const int MAX = 262072;
const int MAXS = MAX * 2 + 7;
bool vis[MAXN];
class stT {
 public:
  stT() {
    memset(mx, -1, sizeof(mx));
    memset(mn, -1, sizeof(mn));
  }
  void add(int l, int r, int x, int now = 1, int ll = 1, int rr = MAX) {
    if (ll >= l && rr <= r)
      col[now].insert(x), upd(now);
    else if (rr < l || ll > r)
      return;
    else {
      int mid = (ll + rr) >> 1;
      add(l, r, x, now << 1, ll, mid);
      add(l, r, x, now << 1 | 1, mid + 1, rr);
      upd(now);
    }
  }
  void del(int l, int r, int x, int now = 1, int ll = 1, int rr = MAX) {
    if (ll >= l && rr <= r)
      col[now].erase(x), upd(now);
    else if (rr < l || ll > r)
      return;
    else {
      int mid = (ll + rr) >> 1;
      del(l, r, x, now << 1, ll, mid);
      del(l, r, x, now << 1 | 1, mid + 1, rr);
      upd(now);
    }
  }
  int query() { return mx[1]; }

 private:
  void upd(int now) {
    mn[now] = max(((col[now].empty()) ? -1 : *col[now].rbegin()),
                  (now < MAX) ? min(mn[now << 1], mn[now << 1 | 1]) : -1);
    int nv = ((col[now].empty()) ? -1 : *col[now].rbegin()),
        cv = (now < MAX) ? max(mx[now << 1], mx[now << 1 | 1]) : -1;
    if (nv > cv)
      mx[now] = (vis[nv] || nv < mn[now]) ? -1 : nv;
    else
      mx[now] = cv;
  }
  set<int> col[MAXS];
  int mx[MAXS], mn[MAXS];
} st;
struct rT {
  int xl, yl, xr, yr;
} rect[MAXN];
struct eT {
  void setd(int _t, int _tp, int _id) { t = _t, tp = _tp, id = _id; }
  bool operator<(const eT &a) const { return t < a.t; }
  int t, tp, id;
} ev[MAXN];
int n;
int stb[MAXN];
void init();
void input();
void work();
int main() {
  init();
  input();
  work();
}
void init() { ios::sync_with_stdio(false); }
void input() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    scanf("%d%d%d%d", &rect[i].xl, &rect[i].yl, &rect[i].xr, &rect[i].yr);
}
void work() {
  for (int i = 1; i <= n; ++i) --rect[i].yr;
  int ks = 0;
  for (int i = 1; i <= n; ++i)
    stb[++ks] = rect[i].yl, stb[++ks] = rect[i].yr + 1;
  sort(stb + 1, stb + 1 + ks);
  ks = unique(stb + 1, stb + 1 + ks) - stb - 1;
  for (int i = 1; i <= n; ++i)
    rect[i].yl = lower_bound(stb + 1, stb + 1 + ks, rect[i].yl) - stb,
    rect[i].yr = upper_bound(stb + 1, stb + 1 + ks, rect[i].yr) - stb - 1;
  int ke = 0;
  for (int i = 1; i <= n; ++i) {
    ev[ke++].setd(rect[i].xl, 1, i);
    ev[ke++].setd(rect[i].xr, 0, i);
  }
  sort(ev, ev + ke);
  ev[ke].t = INF;
  int ni, ret;
  for (int i = 0; i < ke; ++i) {
    ni = ev[i].id;
    if (ev[i].tp)
      st.add(rect[ni].yl, rect[ni].yr, ni);
    else
      st.del(rect[ni].yl, rect[ni].yr, ni);
    if (ev[i].t ^ ev[i + 1].t) {
      while (~(ret = st.query())) {
        st.del(rect[ret].yl, rect[ret].yr, ret);
        vis[ret] = true;
        st.add(rect[ret].yl, rect[ret].yr, ret);
      }
    }
  }
  int ans = 1;
  for (int i = 1; i <= n; ++i)
    if (vis[i]) ++ans;
  cout << ans << endl;
}
