n=int(input()) a=[int(n) for n in input().split(' ')] k=list(set(a)) k=sorted(k) t=0 for i in k: a.remove(i) a.remove(i-1) a.remove(i+1) t=t+i if(len(a)==0): break print(t)
8 7 2 1 8 3 3 6 6
Standard output is empty
Traceback (most recent call last): File "./prog.py", line 8, in <module> ValueError: list.remove(x): x not in list