import bisect def func(a_list, b_list): ans = 0 prev = 0 while True: i = bisect.bisect_right(a_list, prev) if i == len(a_list): break prev = a_list[i] ans += 1 i = bisect.bisect_right(b_list, prev) if i == len(b_list): break prev = b_list[i] ans += 1 return ans def main(): nw = input() w_list = list(sorted(map(int, input().split()))) nb = input() b_list = list(sorted(map(int, input().split()))) print(max(func(w_list, b_list), func(b_list, w_list))) if __name__ == '__main__': main()