Sort array in fun order