using System;
namespace App {
class Program {
static void Main(string[] args) {
int n = Convert.ToInt32(Console.ReadLine());
int[] a = new int[n];
int[] b = new int[0];
Random rand = new Random();
for (int i = 0; i < n; i++) {
a[i] = rand.Next(0, 11);
Console.Write(a[i] + " ");
}
int num= Int32.MaxValue;
Array.Sort(a); Console.WriteLine();
for (int i = 0; i < n; i++) {
if (a[i] != num) {
int c = 0;
for (int j = i; j < n; j++) if (a[i] == a[j]) { c++; num = a[i]; }
if (c <= 2) <span>{
Array.Resize(ref b, b.Length + 1);
b[b.Length - 1] = a[i];
}
}
}
for (int i = 0; i < b.Length; i++) Console.Write(b[i] + " ");
Console.ReadKey();
}
}
}