modified the counting sorting