modified program to calculate and display the number of collisions