SQL query, group by and number of occurrences
This should work:

select count(*), a.N FROM (SELECT count(*) as N FROM table1 GROUP BY x) a GROUP BY a.N;


SQLFiddle

Note that it gives you 3 for N = 3, because there are actually three number repeated thrice: 1, 3 and 7.