sorry, but your querie results are incorrect

you have to devide the result by two.
why?
as an example
user1 user2 and user3 have the same password:
result will count:
user1.pw = user2.pw -> 1
user1.pw = user3.pw -> 2
user2.pw = user1.pw -> 3
user2.pw = user3.pw -> 4
user3.pw = user1.pw -> 5
user3.pw = user2.pw -> 6
so there are 3 users with the same password, but the result is 6.