#include<bits/stdc++.h>
using namespace std;
int main() {
int n, i, count;
vector<int> v;
cin >> n;
for (int j = 0; j < n; ++j) {
cin >> i;
v.push_back(i);
}
sort(v.begin(), v.end());
auto it = unique(v.begin(), v.end());
auto end_unique = it;
while (end_unique++ < v.end())
++count;
cout << n - count << endl;
for (auto beg = v.begin(); beg < it; ++beg) {
if (beg != v.begin())
cout << " ";
cout << *beg;
}
return 0;
}