modified code to get data from input file and then sort the received values