local n = io.read("*n")
local red, blue = {}, {}
for i = 1, n do
  red[i] = {}
  red[i].x, red[i].y = io.read("*n", "*n")
end
for i = 1, n do
  blue[i] = {}
  blue[i].x, blue[i].y = io.read("*n", "*n")
  blue[i].used = false
end
table.sort(red, function(s, t) return s.x > t.x end)
table.sort(blue, function(s, t) return s.y < t.y end)

local cnt = 0
for i = 1, n do
  local rx, ry = red[i].x, red[i].y
  for j = 1, n do
    if rx < blue[j].x and ry < blue[j].y and not blue[j].used then
      cnt = cnt + 1
      blue[j].used = true
      break
    end
  end
end
print(cnt)
