# 체육복
def solution(n, lost, reserve):
cnt = 0
same = set(lost) & set(reserve)
reserve = list(set(reserve) - same)
for i in list(set(lost) - same):
if i-1 in reserve:
reserve.remove(i-1)
elif i+1 in reserve:
reserve.remove(i+1)
else:
cnt += 1
return n - cnt