all possibilities: 2^(2n-1)
number of possibilities that we have substrings of length n that are all 1 : n* 2^(n-1)
so number of possibilities in which we have substrings of length n that are all 1 or 0:
n* 2^n
so the number is: 2^(2n-1) – n 2^n
= (2^n)(2^(n-1) – n)