I have found this to be the most compact answer:
=ArrayFormula(SUM(--(COUNTIF(A1:A7;A1:A7)=2))/2) #for doubles =ArrayFormula(SUM(--(COUNTIF(A1:A7;A1:A7)=3))/3) #for triples
Dropping the "ArrayFormula" component to use in excel.