got permutation working, still need to figure out how to calculate minimum, then calculate diff (if ties exist)