import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        Set<Integer> set = new TreeSet<>();
        for (int i=0; i<N; i++) {
            set.add(scanner.nextInt());
        }
        scanner.close();

        for (Integer integer : set) {
            System.out.println(integer);
        }
    }
}

使用TreeSet自动排序。