How many ordered integer pairs $(x, y)$, where $0 \leq x, y < 31$, satisfy the equation $(x^2 - 18)^2 \equiv y^2 \pmod{31}$? Provide your answer as an integer.

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