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 long long MOD = 1e9 + 7;
const long long inf = 10000000;
const long long N = 4e5 + 5;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline bool isLeapYear(long long year) {
  return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}
inline void normal(long long &a) {
  a %= MOD;
  (a < 0) && (a += MOD);
}
inline long long modMul(long long a, long long b) {
  a %= MOD, b %= MOD;
  normal(a), normal(b);
  return (a * b) % MOD;
}
inline long long modAdd(long long a, long long b) {
  a %= MOD, b %= MOD;
  normal(a), normal(b);
  return (a + b) % MOD;
}
inline long long modSub(long long a, long long b) {
  a %= MOD, b %= MOD;
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
inline long long modPow(long long b, long long p) {
  long long r = 1;
  while (p) {
    if (p & 1) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1;
  }
  return r;
}
inline long long modInverse(long long a) { return modPow(a, MOD - 2); }
inline long long modDiv(long long a, long long b) {
  return modMul(a, modInverse(b));
}
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
long long x1[N], x2[N], yy1[N], y2[N], ux[N], uy[N], cx, cy, mx[N << 2],
    mn[N << 2], n, id[N];
vector<long long> I[N], E[N];
set<long long> colors[N << 2];
void update(long long node) {
  long long mxv, mxc, mnc;
  if (!colors[node].size())
    mxv = -1;
  else {
    mxv = *(--colors[node].end());
  }
  mxc = max(mx[2 * node], mx[2 * node + 1]);
  mnc = min(mn[2 * node], mn[2 * node + 1]);
  if (mxv > mxc) {
    if (id[mxv] || mxv < mnc) {
      mx[node] = -1;
    } else
      mx[node] = mxv;
  } else
    mx[node] = mxc;
  mn[node] = max(mxv, mnc);
}
void add(long long node, long long b, long long e, long long p, long long mode,
         long long l = 1, long long r = cy) {
  if (b > e) return;
  if (b <= l and e >= r) {
    if (mode == 1)
      colors[node].insert(p);
    else if (mode == -1)
      colors[node].erase(p);
    update(node);
    return;
  }
  if (b <= ((l + r) / 2)) add(2 * node, b, e, p, mode, l, ((l + r) / 2));
  if (e > ((l + r) / 2)) add(2 * node + 1, b, e, p, mode, ((l + r) / 2) + 1, r);
  update(node);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  scanf("%lld", &n);
  memset(mx, -1, sizeof mx);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld %lld", &x1[i], &yy1[i]);
    scanf("%lld %lld", &x2[i], &y2[i]);
    ux[++cx] = x1[i];
    ux[++cx] = x2[i];
    uy[++cy] = yy1[i];
    uy[++cy] = y2[i];
  }
  sort(ux + 1, ux + cx + 1);
  sort(uy + 1, uy + cy + 1);
  cx = unique(ux + 1, ux + 1 + cx) - ux - 1;
  cy = unique(uy + 1, uy + cy + 1) - uy - 1;
  for (long long i = 1; i <= n; i++) {
    x1[i] = lower_bound(ux + 1, ux + cx + 1, x1[i]) - ux;
    x2[i] = lower_bound(ux + 1, ux + cx + 1, x2[i]) - ux;
    yy1[i] = lower_bound(uy + 1, uy + cy + 1, yy1[i]) - uy;
    y2[i] = lower_bound(uy + 1, uy + cy + 1, y2[i]) - uy;
    I[x1[i]].push_back(i);
    E[x2[i]].push_back(i);
  }
  for (long long i = 1; i <= cx; i++) {
    for (auto X : I[i]) add(1, yy1[X], y2[X] - 1, X, 1);
    for (auto X : E[i]) add(1, yy1[X], y2[X] - 1, X, -1);
    while (~mx[1]) {
      long long X = mx[1];
      id[X] = 1;
      add(1, yy1[X], y2[X] - 1, X, 0);
    }
  }
  long long ans = 1;
  for (int i = 1; i <= n; i++) {
    if (id[i]) ans++;
  }
  printf("%lld\n", ans);
  return 0;
}
