#include<bits/stdc++.h>
using namespace std;
void distinctElements(int arr[], int n) {
int i, j, count = 1;
sort(arr, arr + n);
for(i = 0; i < n - 1; i++) {
if (arr[i] != arr[i + 1]) {
count++;
out << arr[i] << " ";
}
}
cout << arr[n - 1] << " ";
cout << "\nSo phan tu khac nhau cua mang la: " << count << endl;
}
int main() {
int arr[] = {1, 2, 3, 4, 4, 5, 6, 6, 7, 7, 7, 8, 9, 9};
int n = sizeof(arr) / sizeof(arr[0]);
distinctElements(arr, n);
return 0;
}