Find the total number of triples of integers $(x,y,n)$ satisfying the equation $\tfrac 1x+\tfrac 1y=\tfrac1{n^2}$, where $n$ is either $2012$ or $2013$.

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