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 = 400005;
struct Rect {
  int x1, y1, x2, y2;
} a[N];
struct TNode {
  set<int> v;
  int mn, mx, l, r;
} t[N << 2];
inline int lc(int pos) { return pos << 1; }
inline int rc(int pos) { return pos << 1 | 1; }
bool vis[N];
int n;
void pushup(int pos) {
  t[pos].mn = min(t[lc(pos)].mn, t[rc(pos)].mn);
  t[pos].mx = max(t[lc(pos)].mx, t[rc(pos)].mx);
  if (!t[pos].v.empty() && *t[pos].v.rbegin() > t[pos].mx)
    t[pos].mx = vis[*t[pos].v.rbegin()] ? 0 : *t[pos].v.rbegin();
  if (!t[pos].v.empty()) t[pos].mn = max(t[pos].mn, *t[pos].v.rbegin());
  if (t[pos].mx < t[pos].mn) t[pos].mx = 0;
}
void build(int pos, int l, int r) {
  t[pos].l = l;
  t[pos].r = r;
  t[pos].mn = 0;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(lc(pos), l, mid);
  build(rc(pos), mid + 1, r);
  pushup(pos);
}
void modify(int pos, int l, int r, int v, int fl) {
  if (t[pos].l == l && t[pos].r == r) {
    if (fl == 1)
      t[pos].v.insert(v);
    else if (fl == -1)
      t[pos].v.erase(v);
    return pushup(pos);
  }
  int mid = (t[pos].l + t[pos].r) >> 1;
  if (r <= mid)
    modify(lc(pos), l, r, v, fl);
  else if (l > mid)
    modify(rc(pos), l, r, v, fl);
  else
    modify(lc(pos), l, mid, v, fl), modify(rc(pos), mid + 1, r, v, fl);
  pushup(pos);
}
vector<int> q[N];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  vector<int> xp, yp;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].x1 >> a[i].y1 >> a[i].x2 >> a[i].y2;
    xp.push_back(a[i].x1);
    yp.push_back(a[i].y1);
    xp.push_back(a[i].x2);
    yp.push_back(a[i].y2);
  }
  sort(xp.begin(), xp.end());
  xp.erase(unique(xp.begin(), xp.end()), xp.end());
  sort(yp.begin(), yp.end());
  yp.erase(unique(yp.begin(), yp.end()), yp.end());
  for (int i = 1; i <= n; i++) {
    a[i].x1 = lower_bound(xp.begin(), xp.end(), a[i].x1) - xp.begin() + 1;
    a[i].y1 = lower_bound(yp.begin(), yp.end(), a[i].y1) - yp.begin() + 1;
    a[i].x2 = lower_bound(xp.begin(), xp.end(), a[i].x2) - xp.begin();
    a[i].y2 = lower_bound(yp.begin(), yp.end(), a[i].y2) - yp.begin();
    q[a[i].x1].push_back(i);
    q[a[i].x2 + 1].push_back(-i);
  }
  build(1, 1, int(yp.size()));
  int ans = 1;
  for (int i = 1; i <= int(xp.size()); i++) {
    for (auto &j : q[i]) {
      int p = abs(j);
      modify(1, a[p].y1, a[p].y2, p, j > 0 ? 1 : -1);
    }
    while (t[1].mx) {
      ++ans;
      int p = t[1].mx;
      vis[p] = 1;
      modify(1, a[p].y1, a[p].y2, p, 0);
    }
  }
  cout << ans << endl;
  return 0;
}
