5.1. How many six-digit numbers exist that consist only of the digits 1 and 2, given that each of them appears?
Answer: 62

Solution. There are a total of $64=2^{6}$ six-digit numbers consisting of the digits 1 and 2, since there are 6 positions and for each position, there are two options to place a digit. However, two numbers - the one consisting only of ones and the one consisting only of twos - do not satisfy the condition, so 62 numbers remain.