output_description: Print the maximum number of friendly pairs.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      a_1 b_1
      a_2 b_2
      :
      a_N b_N
      c_1 d_1
      c_2 d_2
      :
      c_N d_N
attempt: # 91c
  N = int(input())  # N<=100
  
  red_points = list()
  for i in range(N):
      a, b = map(int, input().split())
      red_points.append((a, b))
  
  blue_points = list()
  for i in range(N):
      c, d = map(int, input().split())
      blue_points.append((c, d))
  
  # 赤い点と青い点は，
  # 赤い点の x 座標が青い点の x 座標より小さく， また
  # 赤い点の y 座標も青い点の y座標より小さい    とき，
  # 仲良しペアになれます。
  # あなたは最大で何個の仲良しペアを作ることができますか？ ただし，1つの点が複数のペアに所属することはできません。
  
  # 100*100 = 10**4ループを回して、ペアになれる点同士を算出
  pairable_dict = dict()  # key:red_point , value:pairable blue point
  for red_point in red_points:
      pairable_dict[red_point] = set()
      red_point_x = red_point[0]
      red_point_y = red_point[1]
      for blue_point in blue_points:
          blue_point_x = blue_point[0]
          blue_point_y = blue_point[1]
          if red_point_x < blue_point_x and red_point_y < blue_point_y:
              pairable_dict[red_point].add(blue_point)
  
  # print(pairable_dict)
  
  
  pair_dict = dict()  # key:red_point , value:paired blue point
  used_blue_points = set()
  
  
  # ペアになれる相手が単独なら確定していく
  def make_unique_pair():
      for pair in pairable_dict.items():
          red_point = pair[0]
          blue_points = pair[1]
          blue_points = blue_points - (blue_points & used_blue_points)
  
          # print(red_point,blue_points)
  
          if len(blue_points) == 1:
              # print("paired")
              blue_point = blue_points.pop()
              pair_dict[red_point] = blue_point
              used_blue_points.add(blue_point)
              pairable_dict[red_point] = set()
              make_unique_pair()
  
  
  # 単独ペア確定後は、近い点からやっていく
  def make_pair():
      for pair in pairable_dict.items():
          red_point = pair[0]
          blue_points = pair[1]
          blue_points = blue_points - (blue_points & used_blue_points)
  
          if len(blue_points) != 0:
              # 最も近い点を使う
              min_d_point = blue_points.pop()
              min_distance = min_d_point[0] ** 2 + min_d_point[1] ** 2
  
              for blue_point in blue_points:
                  if blue_point[0] ** 2 + blue_point[1] ** 2 < min_distance:
                      min_distance = blue_point[0] ** 2 + blue_point[1] ** 2
                      min_d_point = blue_point
  
              pair_dict[red_point] = min_d_point
              used_blue_points.add(min_d_point)
              pairable_dict[red_point] = set()
              make_pair()
  
  
  make_unique_pair()
  make_pair()
  
  print(len(pair_dict))
  # print(pair_dict)
  
problem_description: Statement
  
  On a two-dimensional plane, there are N red points and N blue points. The
  coordinates of the i-th red point are (a_i, b_i), and the coordinates of the
  i-th blue point are (c_i, d_i).
  
  A red point and a blue point can form a _friendly pair_ when, the x-coordinate
  of the red point is smaller than that of the blue point, and the y-coordinate
  of the red point is also smaller than that of the blue point.
  
  At most how many friendly pairs can you form? Note that a point cannot belong
  to multiple pairs.
samples: [{"input": "3\n    2 0\n    3 1\n    1 3\n    4 2\n    0 4\n    5 5", "output": "2\n    \n\nFor example, you can pair (2, 0) and (4, 2), then (3, 1) and (5, 5).\n\n* * *"}, {"input": "3\n    0 0\n    1 1\n    5 2\n    2 3\n    3 4\n    4 5", "output": "2\n    \n\nFor example, you can pair (0, 0) and (2, 3), then (1, 1) and (3, 4).\n\n* * *"}, {"input": "2\n    2 2\n    3 3\n    0 0\n    1 1", "output": "0\n    \n\nIt is possible that no pair can be formed.\n\n* * *"}, {"input": "5\n    0 0\n    7 3\n    2 2\n    4 8\n    1 6\n    8 5\n    6 9\n    5 4\n    9 1\n    3 7", "output": "5\n    \n\n* * *"}, {"input": "5\n    0 0\n    1 1\n    5 5\n    6 6\n    7 7\n    2 2\n    3 3\n    4 4\n    8 8\n    9 9", "output": "4"}]