Find the positive integer $n$ such that
\[\sin \left( \frac{\pi}{2n} \right) + \cos \left (\frac{\pi}{2n} \right) = \frac{\sqrt{n}}{2}.\]

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