|
@@ -0,0 +1,28 @@
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Scanner;
|
|
|
+
|
|
|
+public class D {
|
|
|
+ public static void main(String[] args) {
|
|
|
+ int[] a = new int[cin.nextInt()];
|
|
|
+ for (int i = 0; i < a.length; i++) {
|
|
|
+ a[i] = cin.nextInt();
|
|
|
+ }
|
|
|
+
|
|
|
+ Arrays.sort(a);
|
|
|
+ int count = 0;
|
|
|
+ for (int i = 0; i < a.length; i++) {
|
|
|
+ if (i == 0 || a[i] != a[i - 1])
|
|
|
+ ++count;
|
|
|
+ }
|
|
|
+ System.out.println(count);
|
|
|
+
|
|
|
+
|
|
|
+ for (int i = 0; i < a.length; i++) {
|
|
|
+ if (i == 0 || a[i] != a[i - 1])
|
|
|
+ System.out.print(a[i] + " ");
|
|
|
+ }
|
|
|
+ System.out.println();
|
|
|
+ }
|
|
|
+
|
|
|
+ static Scanner cin = new Scanner(System.in);
|
|
|
+}
|