Actually you may let the one you are showing the trick to to choose the order, you need just to notice where did the column with the card go. 2 if it is on the bottom, 1 if in the middle, 0 if on the top. When you got your three digits, reverse them and convert from ternary to decimal—that will be the number of cards above yours. In the case you are putting column with a card to the middle you'd get 111, that is 13^2+13^1+1*3^0=9+3+1=13. Hence your card is #14.
I think this was in one of the books by M. Gardner.
I think this was in one of the books by M. Gardner.