sorted terminal number