#http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2435165
#AOJ最大流プログラム
#FOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

import collections
class Dinic:

    def __init__(self, n):
        self.n = n
        self.g = [[] for i in range(n)]

    def add_edge(self, fr, to, cap):
        self.g[fr].append([to, cap, len(self.g[to])])
        self.g[to].append([fr, 0, len(self.g[fr])-1])

    def add_multi_edge(self, v1, v2, cap1, cap2):
        self.g[v1].append([v2, cap1, len(self.g[v2])])
        self.g[v2].append([v1, cap2, len(self.g[v1])-1])

    def bfs(self, s):
        level = [-1]*self.n
        deq = collections.deque()
        level[s] = 0
        deq.append(s)
        while deq:
            v = deq.popleft()
            for e in self.g[v]:
                if e[1]>0 and level[e[0]]<0:
                    level[e[0]] = level[v] + 1
                    deq.append(e[0])
        self.level = level

    def dfs(self, v, t, f):
        if v==t: return f
        es = self.g[v]
        level = self.level
        for i in range(self.it[v], len(self.g[v])):
            e = es[i]
            if e[1]>0 and level[v]<level[e[0]]:
                d = self.dfs(e[0], t, min(f, e[1]))
                if d>0:
                    e[1] -= d
                    self.g[e[0]][e[2]][1] += d
                    self.it[v] = i
                    return d
        self.it[v] = len(self.g[v])
        return 0

    def max_flow(self, s, t):
        flow = 0
        while True:
            self.bfs(s)
            if self.level[t]<0: break
            self.it = [0]*self.n
            while True:
                f = self.dfs(s, t, 10**9+7)
                if f>0:
                    flow += f
                else:
                    break
        return flow

#FOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO


#今回の問題分（インプット、頂点の組）FOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

n=int(input())
s=[]
ss=[]
for i in range(n):
    s.append([int(i) for i in input().split()])
    
for i in range(n):
    ss.append([int(i) for i in input().split()])

pair=[]
for i in range(len(s)):
    right=[]
    for j in range(n):    
        if s[j][0]<ss[i][0] and s[j][1]<ss[i][1]:
            right.append(j)
    pair.append(right)

#print(pair)

#FOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO


#頂点の組u,vと辺の重みc（今回は1）からグラフ作って最大流で解くFOOOOOOOOOOOOOOOOO

V=len(pair)+n+2 #(sとt追加)

dinic = Dinic(V)

for i in range(len(pair)): #始点s（番号0）から青い点(1から最大len(pair))への辺
    u, v, c = 0, i+1, 1
    dinic.add_edge(u, v, c)
            
for i in range(n): #　赤い点（len(pair)+1から最大len(pair)+n）から終点t（番号V-1）への辺
    u, v, c = i+len(pair)+1, V-1, 1
    dinic.add_edge(u, v, c)    
    
for i in range(len(pair)): #青い点（番号1から最大len(pair)に振り直し）から　赤い点（番号1～100に振り直し）への辺
    for j in range(len(pair[i])):
        node1, node2 = i+1,pair[i][j]+len(pair)+1
        
        u, v, c = node1, node2, 1
        dinic.add_edge(u, v, c)
        
print (dinic.max_flow(0, V-1))     

#FOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO


"""
元々のinput
V, E =  [int(i) for i in input().split()]

dinic = Dinic(V)

for i in range(E):
    u, v, c = [int(i) for i in input().split()]
    dinic.add_edge(u, v, c)

print (dinic.max_flow(0, V-1))
"""




Measured memory_bytes: 4084