Now sorts according to some user determined array in the array of arrays
Finds the number of different elements in an array