Another way, that doesn't involve Array formulas and is more efficient is to use a helper column... e.g. in C2

=COUNTIFS(A$2:A2,A2,B$2:B2,B2)=1

copied down

then count the TRUE's

=COUNTIF(C:C,TRUE)

then numbers should match to the original formula and allow you to verify.