How to calculate all possible combinations of 1 to n variables taking 2 values

You have three choices for each of the $n$ variables: $0$, $1$, or omit. That would give you $3^n$ choices. However, in your lists, you are omitting the case where all omits occurs, which leaves you with $3^n - 1$ possible outcomes when you have $n$ variables.