Taking a hand (14 mahjong tiles) and figuring out the number of tiles you have to replace to have a winning hand.
This doesn't take account for the value, but just that a hand is in a winning state.
Tenpai is determined if a hand has a Shanten of 1.