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>
#pragma GCC optimize(2)
using namespace std;
void qread(int &x) {
  int neg = 1;
  x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = 10 * x + c - '0', c = getchar();
  x *= neg;
}
const int maxn = 200005;
int n, ys;
bool ans[maxn];
int xl[maxn], xr[maxn], yl[maxn], yr[maxn];
map<int, int> num;
namespace Segtree {
class node {
 public:
  set<int> s;
  int mx, mn, c, hmx;
  node() {
    s.clear();
    mx = mn = c = hmx = 0;
  }
  void add(int x) {
    s.insert(x);
    c = *s.rbegin();
  }
  void del(int x) {
    s.erase(s.find(x));
    if (s.empty())
      c = 0;
    else
      c = *s.rbegin();
  }
  void upd(int x) {
    if (c >= x) ans[c] = true;
  }
} t[maxn * 4];
void updateu(int v) { t[v].mx = max(t[v].c, t[v >> 1].mx); }
void updated(int v, bool leaf) {
  t[v].mn = max(t[v].c, (leaf ? 0 : min(t[v << 1].mn, t[v << 1 | 1].mn)));
}
void pushdown(int v, bool leaf) {
  t[v].upd(max(t[v].mn, max(t[v].hmx, t[v].c)));
  if (!leaf) {
    int cmx = max(t[v].hmx, t[v].c);
    t[v << 1].hmx = min(t[v << 1].hmx, cmx);
    t[v << 1 | 1].hmx = min(t[v << 1 | 1].hmx, cmx);
  }
  t[v].hmx = t[v >> 1].mx;
}
void update(int v, int l, int r, int vl, int vr, int val, int op) {
  pushdown(v, l == r);
  updateu(v);
  if (l >= vl && r <= vr) {
    if (op > 0)
      t[v].add(val);
    else
      t[v].del(val);
    updateu(v);
    updated(v, l == r);
    if (l != r) {
      t[v << 1].hmx = min(t[v << 1].hmx, t[v].mx);
      t[v << 1 | 1].hmx = min(t[v << 1 | 1].hmx, t[v].mx);
    }
    t[v].upd(max(t[v].mn, t[v].mx));
    return;
  }
  int mid = (l + r) >> 1;
  if (mid >= vl) update(v << 1, l, mid, vl, vr, val, op);
  if (mid < vr) update(v << 1 | 1, mid + 1, r, vl, vr, val, op);
  updated(v, l == r);
  t[v].upd(max(t[v].mn, t[v].mx));
}
}  // namespace Segtree
class Query {
 public:
  int t, id, op;
  Query() {}
  Query(int _t, int _id, int _op) : t(_t), id(_id), op(_op) {}
  bool operator<(const Query &o) const {
    if (t != o.t) return t < o.t;
    if (op != o.op) return op > o.op;
    if (op == 1)
      return id > o.id;
    else
      return id < o.id;
  }
} q[maxn];
int main() {
  scanf("%d", &n);
  int eve = 0;
  for (int(i) = 1; (i) <= n; i++) {
    scanf("%d%d%d%d", &xl[i], &yl[i], &xr[i], &yr[i]);
    num[yl[i]] = num[yr[i]] = 0;
    q[eve++] = Query(xl[i], i, 1);
    q[eve++] = Query(xr[i], i, 0);
  }
  sort(q, q + eve);
  for (map<int, int>::iterator it = num.begin(); it != num.end(); it++)
    it->second = ++ys;
  for (int(i) = 0; (i) < eve; i++) {
    int l = num[yl[q[i].id]], r = num[yr[q[i].id]] - 1;
    Segtree::update(1, 1, ys, l, r, q[i].id, q[i].op);
  }
  int res = 1;
  for (int(i) = 1; (i) <= n; i++) res += ans[i];
  printf("%d\n", res);
  return 0;
}
