Step 1: Expand \(\cos x-1\) near \(x=0\).
Using the Maclaurin series,
\[
\cos x=1-\frac{x^2}{2}+\frac{x^4}{24}+\cdots
\]
Therefore,
\[
\cos x-1=-\frac{x^2}{2}+\frac{x^4}{24}+\cdots
\]
Hence, the lowest degree term is
\[
\cos x-1\sim -\frac{x^2}{2}
\]
Step 2: Expand \(\cos x-e^x\) near \(x=0\).
Using
\[
e^x=1+x+\frac{x^2}{2}+\frac{x^3}{6}+\cdots
\]
and
\[
\cos x=1-\frac{x^2}{2}+\frac{x^4}{24}+\cdots
\]
we get
\[
\cos x-e^x
=
\left(1-\frac{x^2}{2}+\cdots\right)
-
\left(1+x+\frac{x^2}{2}+\frac{x^3}{6}+\cdots\right)
\]
\[
=-x-x^2-\frac{x^3}{6}+\cdots
\]
Hence, the lowest degree term is
\[
\cos x-e^x\sim -x
\]
Step 3: Find the lowest degree term of the numerator.
Multiplying the leading terms,
\[
(\cos x-1)(\cos x-e^x)
\sim
\left(-\frac{x^2}{2}\right)(-x)
\]
\[
=\frac{x^3}{2}
\]
Thus,
\[
(\cos x-1)(\cos x-e^x)
=
\frac{x^3}{2}
+\text{higher order terms}
\]
Step 4: Determine the value of \(n\).
The limit becomes
\[
\lim_{x\to 0}
\frac{\frac{x^3}{2}+\cdots}{x^n}
\]
For the limit to be finite and non-zero, the power of \(x\) in the denominator must match the lowest power of \(x\) in the numerator.
Therefore,
\[
n=3
\]
Step 5: Verify the limit.
Substituting \(n=3\),
\[
\lim_{x\to 0}
\frac{(\cos x-1)(\cos x-e^x)}{x^3}
=
\frac{1}{2}
\]
which is finite and non-zero.
Hence, the required integral value of \(n\) is
\[
3
\]
Step 6: Final conclusion.
Therefore,
\[
\boxed{3}
\]