Step 1: Use the identity for complementary angles.
We know that
\[
\tan(45^\circ-\theta)=\frac{1-\tan\theta}{1+\tan\theta}
\]
Now, consider
\[
(1+\tan\theta)(1+\tan(45^\circ-\theta))
\]
Substituting the identity,
\[
(1+\tan\theta)\left(1+\frac{1-\tan\theta}{1+\tan\theta}\right)
\]
\[
=(1+\tan\theta)\left(\frac{1+\tan\theta+1-\tan\theta}{1+\tan\theta}\right)
\]
\[
=(1+\tan\theta)\left(\frac{2}{1+\tan\theta}\right)
\]
\[
=2
\]
Step 2: Pair the terms.
The terms from \(1^\circ\) to \(44^\circ\) can be paired as
\[
(1^\circ,44^\circ), (2^\circ,43^\circ), \ldots, (22^\circ,23^\circ)
\]
There are \(22\) such pairs.
Each pair gives product \(2\).
Therefore, product of first \(44\) terms is
\[
2^{22}
\]
Step 3: Include the remaining term.
The remaining term is
\[
1+\tan45^\circ
\]
Since
\[
\tan45^\circ=1
\]
we get
\[
1+\tan45^\circ=2
\]
Thus, total product is
\[
2^{22}\cdot 2=2^{23}
\]
Step 4: Compare with \(2^n\).
Given,
\[
(1+\tan1^\circ)(1+\tan2^\circ)\cdots(1+\tan45^\circ)=2^n
\]
So,
\[
2^n=2^{23}
\]
Hence,
\[
n=23
\]
Step 5: Final conclusion.
Therefore,
\[
\boxed{23}
\]