input() w = list(map(lambda x: (int(x), 1), input().split())) input() b = list(map(lambda x: (int(x), 0), input().split())) c = -1 r = 0 o = 0 for p in sorted(w+b, key=lambda p: p[0]): if p[1] != c and p[0] > o: c = p[1] r += 1 o = p[0] print(r)