n = int(input()) s = list(map(int, input().split())) s.sort() tmp = set(s) print(len(tmp)) print(' '.join(map(str, tmp)))