Since 2 occur twice, to fix 2 $2^s$, we have to choose
any two places out of 7 (7digit numbers)
This can be done in $^7C_2$ ways.
Remaining 5 places can be fixed by any of the two numbers, 1or 2
This can be done in $2^5$ ways.
$\therefore$ The required number of 7 digit numbers = $2^5.^7C_2$