Try...

=SUM(1/COUNTIF(A1:A6,A1:A6))

This is a CSE formula which requires Ctrl + Shift + Enter