#include <iostream>
#include <algorithm>
using namespace std;
void printDistinct(int arr[], int n)
{
// First sort the array so that all occurrences become consecutive
sort(arr, arr + n);
int i=0;
// Traverse the sorted array
while(i<n)
{
if(arr[i]==arr[i+1])
{
i=i+1;
}
else
{
cout<<arr[i]<<endl;
i++;
}
}
}
// Driver program to test above function
int main()
{
int arr[] = {6, 10, 5, 4, 9, 120, 4, 6, 10};
int n = sizeof(arr)/sizeof(arr[0]);
printDistinct(arr, n);
return 0;
}