#include <bits/stdc++.h>

template <typename T>
struct Edge {
  int from, to;
  T weight;
};

template <typename T>
class Graph {
 public:
  Graph(int n) : edges_(n) {}
  void AddEdge(int from, int to, T weight = T()) {
    edges_[from].push_back({from, to, weight});
  }
  const std::vector<Edge<T>>& Edges(int from) const { return edges_[from]; }
  int NumVertices() const { return edges_.size(); }

 private:
  std::vector<std::vector<Edge<T>>> edges_;
};

template <typename T, typename _ = void>
struct is_container : std::false_type {};
template <typename T>
struct is_container<T, std::void_t<decltype(std::declval<T>().begin()),
                                   decltype(std::declval<T>().end())>>
    : std::true_type {};
template <typename T, typename _ = void>
struct is_pair : std::false_type {};
template <typename T>
struct is_pair<T, std::void_t<decltype(std::declval<T>().first),
                              decltype(std::declval<T>().second)>>
    : std::true_type {};
template <typename T>
void debug(const T& v) {
  if constexpr (is_pair<T>::value) {
    std::cerr << "{";
    debug(v.first);
    std::cerr << ", ";
    debug(v.second);
    std::cerr << "}";
  } else if constexpr (is_container<T>::value) {
    std::cerr << "{";
    for (auto it = v.begin(); it != v.end(); ++it) {
      if (it != v.begin()) std::cerr << ", ";
      debug(*it);
    }
    std::cerr << "}";
  } else {
    std::cerr << v;
  }
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  debug(value);
  std::cerr << ", ";
  debug(args...);
}
#if DEBUG
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  if constexpr (std::is_same<T, bool>::value) {
    std::cout << (value ? "Yes" : "No");
  } else {
    std::cout << value;
  }
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  write_to_cout(value);
  std::cout << ' ';
  write_to_cout(args...);
}
#define wt(...)                 \
  do {                          \
    write_to_cout(__VA_ARGS__); \
    cout << '\n';               \
  } while (0)

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; --i)

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& v) {
  for (T& vi : v) is >> vi;
  return is;
}

template <typename T, typename U>
bool chmax(T& a, U b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T, typename U>
bool chmin(T& a, U b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

#include <boost/hana/functional/fix.hpp>
auto Fix = boost::hana::fix;

using ll = long long;

template <typename T>
using low_priority_queue =
    std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

template <typename T>
T FordFulkerson(const Graph<T>& g, int s, int d) {
  VV<T> flow(g.NumVertices(), V<T>(g.NumVertices()));
  T total = 0;
  while (true) {
    queue<pair<int, T>> que;
    que.push({s, numeric_limits<T>::max()});
    V<int> prev(g.NumVertices(), -1);
    while (!que.empty()) {
      auto [h, x] = que.front();
      que.pop();
      if (h == d) {
        total += x;
        while (h != s) {
          dbg(prev[h], h, x);
          flow[prev[h]][h] += x;
          flow[h][prev[h]] -= x;
          h = prev[h];
        }
        break;
      }
      for (auto& e : g.Edges(h)) {
        if (prev[e.to] != -1) continue;
        T residue = e.weight - flow[e.from][e.to];
        if (residue == 0) continue;
        prev[e.to] = e.from;
        que.push({e.to, min(x, residue)});
      }
    }
    dbg(total);
    if (prev[d] == -1) break;
  }
  return total;
}

struct XY {
  int x, y;
};

int main() {
  rd(int, n);
  Graph<int> g(n * 2 + 2);
  V<XY> r(n), b(n);
  rep(i, n) cin >> r[i].x >> r[i].y;
  rep(i, n) cin >> b[i].x >> b[i].y;
  const int r0 = 0, b0 = r0 + n, s = b0 + n, d = s + 1;
  auto add = [&](int i, int j) {
    g.AddEdge(i, j, 1);
    g.AddEdge(j, i, 0);
  };
  rep(i, n) add(s, r0 + i);
  rep(i, n) add(b0 + i, d);
  rep(i, n) rep(j, n) if (r[i].x < b[j].x && r[i].y < b[j].y)
      add(r0 + i, b0 + j);
  wt(FordFulkerson(g, s, d));
  // rep(i, n) rep(j, n) if (r[i].x < b[j].x && r[i].y < b[j].y) { wt(i, j + n);
  // }
}


Measured memory_bytes: 3904