a program to count pairs with difference