import sequtils,strutils,algorithm,math var wn = stdin.readline.parseInt W = stdin.readline.split.map(parseInt) bn = stdin.readline.parseInt B = stdin.readline.split.map(parseInt) cnt : int b,w : int ans : int B.sort(system.cmp) B.reverse W.sort(system.cmp) W.reverse for k in 0..1: var m : int t : int cnt : int = 1 if k == 0: m = B[0] b = 1 w = 0 t = 0 else: m = W[0] b = 0 w = 1 t = 1 var flag = true while flag: flag = false if t == 0: while w < wn: if W[w] < m: m = W[w] t = 1 flag = true cnt += 1 break else: w += 1 if t == 1: while b < bn: if B[b] < m: m = B[b] t = 0 flag = true cnt += 1 break else: b += 1 ans = max(ans, cnt) echo ans