满分答案:
import copy
n = int(input())
no = list(map(int,input().split()))
no_1 = copy.deepcopy(no)
count = 0
for i in range(n):
if no[i]+1 in no_1:
count = count + 1
if no[i]-1 in no_1:
count = count + 1
no_1.remove(no[i])
print(count)