22 lines
456 B
C++
22 lines
456 B
C++
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
const int N = 1010;
|
|
int a[N];
|
|
int b[N], bl;
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
for (int i = 0; i < n; i++) cin >> a[i];
|
|
sort(a, a + n);
|
|
int pre = -1;
|
|
for (int i = 0; i < n; i++) {
|
|
if (a[i] != pre) {
|
|
pre = a[i];
|
|
b[++bl] = a[i];
|
|
}
|
|
}
|
|
cout << bl << endl;
|
|
for (int i = 1; i <= bl; i++) cout << b[i] << " ";
|
|
return 0;
|
|
} |