I don't really understand the point of this puzzle because if he asks you 18 or 20 each time then you can escape in fewer days than the "correct" solution just by brute forcing the correct answer. There's only a maximum of 4 permutations that you and your friend can come up with.
[edit]
ahhh, I missed the "get it wrong and you die" bit. Thanks for the clarification guys.