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 = 2e5 + 5;
int mx[maxn * 4], mn[maxn * 4], vis[maxn];
set<int> st[maxn * 4];
inline int lc(int u) { return u << 1; }
inline int rc(int u) { return u << 1 | 1; }
inline void co(int u, int l, int r) {
  if (l == r)
    mn[u] = mx[u] = 0;
  else {
    mn[u] = min(mn[lc(u)], mn[rc(u)]);
    mx[u] = max(mx[lc(u)], mx[rc(u)]);
  }
  if (st[u].empty()) return;
  int x = (*st[u].rbegin());
  if (vis[x])
    mn[u] = max(mn[u], x);
  else
    mx[u] = max(mx[u], x);
  if (mn[u] > mx[u]) mx[u] = 0;
}
inline void mdf(int u, int l, int r, int ql, int qr, int x) {
  if (ql <= l && r <= qr) {
    if (x < 0) st[u].erase(-x);
    if (x > 0) st[u].insert(x);
    co(u, l, r);
    return;
  }
  int mid = (l + r) / 2;
  if (ql <= mid) mdf(lc(u), l, mid, ql, qr, x);
  if (mid + 1 <= qr) mdf(rc(u), mid + 1, r, ql, qr, x);
  co(u, l, r);
  return;
}
struct node {
  int x1, y1, x2, y2;
  node(int x1 = 0, int y1 = 0, int x2 = 0, int y2 = 0)
      : x1(x1), y1(y1), x2(x2), y2(y2) {}
};
node a[maxn];
int numx[maxn], lenx, numy[maxn], leny, n;
vector<int> add[maxn], del[maxn];
inline int getx(int x) {
  return lower_bound(numx + 1, numx + lenx + 1, x) - numx;
}
inline int gety(int y) {
  return lower_bound(numy + 1, numy + leny + 1, y) - numy;
}
pair<int, int> b[maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d%d%d", &a[i].x1, &a[i].y1, &a[i].x2, &a[i].y2);
    numx[++lenx] = a[i].x1;
    numx[++lenx] = a[i].x2;
    numy[++leny] = a[i].y1;
    numy[++leny] = a[i].y2;
  }
  sort(numx + 1, numx + lenx + 1);
  sort(numy + 1, numy + leny + 1);
  lenx = unique(numx + 1, numx + lenx + 1) - numx - 1;
  leny = unique(numy + 1, numy + leny + 1) - numy - 1;
  for (int i = 1; i <= n; i++) {
    int xl = getx(a[i].x1), xr = getx(a[i].x2) - 1, yl = gety(a[i].y1),
        yr = gety(a[i].y2) - 1;
    add[xl].push_back(i);
    del[xr].push_back(i);
    b[i] = make_pair(yl, yr);
  }
  int ans = 1;
  for (int d = 1; d <= lenx; d++) {
    for (int i = 0; i < add[d].size(); i++) {
      int id = add[d][i];
      mdf(1, 1, leny, b[id].first, b[id].second, id);
    }
    while (mx[1]) {
      vis[mx[1]] = 1;
      ans++;
      int id = mx[1];
      mdf(1, 1, leny, b[id].first, b[id].second, 0);
    }
    for (int i = 0; i < del[d].size(); i++) {
      int id = del[d][i];
      mdf(1, 1, leny, b[id].first, b[id].second, -id);
    }
  }
  cout << ans << endl;
  return 0;
}
