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 SZ = 1500500;
const int N = 100500;
int x1[N], x2[N], yy1[N], y2[N];
bool erased[N];
priority_queue<int> els[SZ];
int mn[SZ];
int mx[SZ];
int n;
bool seen[N];
enum { ACTION_ADD, ACTION_ERASE, ACTION_VOID };
void recalc(int cur) {
  int max_in_child = max(mx[cur * 2], mx[cur * 2 + 1]);
  while (!els[cur].empty() && erased[els[cur].top()]) {
    els[cur].pop();
  }
  int max_in_vertex = els[cur].empty() ? -1 : els[cur].top();
  int min_in_child = min(mn[cur * 2], mn[cur * 2 + 1]);
  if (max_in_vertex > max_in_child) {
    if (seen[max_in_vertex] || max_in_vertex < min_in_child) {
      mx[cur] = -1;
    } else {
      mx[cur] = max_in_vertex;
    }
  } else {
    mx[cur] = max_in_child;
  }
  mn[cur] = max(max_in_vertex, min_in_child);
}
void update(int cur, int lb, int rb, int id, int action, int l = 0,
            int r = 2 * N) {
  if (lb >= r || rb <= l) {
    return;
  }
  if (lb <= l && rb >= r) {
    if (action == ACTION_ADD) {
      els[cur].push(id);
    }
    recalc(cur);
    return;
  }
  int mid = (l + r) / 2;
  update(cur * 2, lb, rb, id, action, l, mid);
  update(cur * 2 + 1, lb, rb, id, action, mid, r);
  recalc(cur);
}
set<int> cx, cy;
unordered_map<int, int> id_x, id_y;
vector<pair<int, int> > events[2 * N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cout.precision(15);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x1[i] >> yy1[i] >> x2[i] >> y2[i];
    cx.insert(x1[i]);
    cx.insert(x2[i]);
    cy.insert(yy1[i]);
    cy.insert(y2[i]);
  }
  int j = 0;
  for (auto x : cx) {
    id_x[x] = j++;
  }
  j = 0;
  for (auto y : cy) {
    id_y[y] = j++;
  }
  for (int i = 0; i < n; i++) {
    x1[i] = id_x[x1[i]];
    x2[i] = id_x[x2[i]];
    yy1[i] = id_y[yy1[i]];
    y2[i] = id_y[y2[i]];
    events[x1[i]].push_back({i, ACTION_ADD});
    events[x2[i]].push_back({i, ACTION_ERASE});
  }
  for (int i = 0; i < SZ; i++) {
    mx[i] = -1;
  }
  int cnt_x = id_x.size();
  for (int i = 0; i < cnt_x; i++) {
    for (auto e : events[i]) {
      int id = e.first;
      int action = e.second;
      if (action == ACTION_ERASE) {
        erased[id] = true;
      }
      update(1, yy1[id], y2[id], id, action);
    }
    while (mx[1] != -1) {
      int id = mx[1];
      seen[id] = true;
      update(1, yy1[id], y2[id], id, ACTION_VOID);
    }
  }
  int ans = 1;
  for (int i = 0; i < n; i++) {
    if (seen[i]) {
      ans++;
    }
  }
  cout << ans;
}
