#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;
}
