AC
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
Set<Integer> s = new HashSet<>();
List<Integer> l = new ArrayList<>();
int n = sc.nextInt();
sc.nextLine();
int x = 0;
for(int i=1;i<=n;i++) {
x = sc.nextInt();
if(!s.contains(x)) {
s.add(x);
l.add(x);
}
}
Collections.sort(l);
System.out.println(l.size());
for(int y:l) {
System.out.print(y+" ");
}
sc.close();
}
}