Matrix sorted acc. to no. of elements in each row