//丹阳新区实小路彦
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, b = 0;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n; i++)
for(int j = 0; j < n; j++)
if (a[i] < a[j]) swap(a[i], a[j]);
for (int i = 0; i < n; i++)
if (a[i] == a[i + 1])
{
a[i] = 0;
b++;
}
cout << n - b << endl;
for (int i = 0; i < n; i++)
if (a[i] != 0) cout << a[i] << " ";
return 0;
}