For a positive integer $n$, let $f_n(x)=\cos (x) \cos (2 x) \cos (3 x) \cdots \cos (n x)$. Find the smallest $n$ such that $\left|f_n^{\prime \prime}(0)\right|>2023$.

Let's think step by step and output the final answer within \boxed{}.
user