Two prisoners are imprisoned at opposite ends of the prison. They cannot meet, nor exchange any kind of information. However, one day they are brought together by the ward who tells them:
"I shall give you a chance for getting free. In one hour you'll be separated again, and one of you will go back to his cell, while the other one will stay here. I shall show the former six different numbers randomly chosen among the positive integers $ 1, ...., 245 $. He may think about the numbers and then will have to reject one of the six numbers and tell me the other five. I shall write these five numbers down on a piece of paper, in one line and in the same order as I hear them. Then this guy will have to leave the room. The other man will be called in. I show him my piece of paper with the five numbers, and he must say a number. If he says the rejected number, then the two of you will be free. "
How can these two guys get free?