# Numbers can be special

A number is said to be special if the sum of the squares of its digits on even places is equal to the sum of the squares of its digits on odd places.

For example,
$$354$$ is a special number, because $$3^{2} + 4^{2} = 5^{2} = 25$$.
$$1784$$ is a special number, because $$1^{2} + 8^{2} = 7^{2} + 4^{2} = 65$$.

Let $$f(n)$$ be a function that counts the number of special numbers less than or equal to n, and $$g(n)$$ be a function that finds the sum of special numbers less than or equal to $$n$$. Find $$g(f(f(10^{6})))$$.

×