You can use standard container std::map for this purpose.
For example (without testing)
1 2 3 4 5 6 7 8 9 10 11 12
constint N = 20;
int a[N];
srand( time( 0 ) );
std::generate( std::begin( a ), std::end( a ), []{ return ( rand() % ( N / 4 ) ); } );
std::map<int, unsignedint> m;
for ( auto x : a ) ++m[x];
for ( auto p : m ) std::cout << p.first << '\t' << p.second << std::endl;
Write down the process then code it, show us what you can do.
1 idea
First you need to know the size of the array
create a while loop inside a for loop
see if array[x] matches array [y] then subtract 1 from your total because array[0] should always match array[0].