Simplify
\[\cos^2 x + \cos^2 \left( \frac{\pi}{3} + x \right) + \cos^2 \left( \frac{\pi}{3} -  x \right).\]
<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
Simplify
\[\cos^2 x + \cos^2 \left( \frac{\pi}{3} + x \right) + \cos^2 \left( \frac{\pi}{3} -  x \right).\]
Please reason step by step, and put your final answer within \boxed{{}}.<|im_end|>
<|im_start|>assistant

user
\frac{3}{2}
Simplify
\[\cos^2 x + \cos^2 \left( \frac{\pi}{3} + x \right) + \cos^2 \left( \frac{\pi}{3} -  x \right).\]
train