##
Ten Digits and Two Squares

A math wizard has a bag containing the digits 0 through 9,
and he has used six of them to stick two different three-digit
perfect squares on the foreheads of Ann and Ben.
Both Ann and Ben know this fact, but each person can see
the other person's number only. The wizard asks Ann:
"How many of the digits remaining in my bag can you
exactly tell me?"
- Ann replies: "Three."
The wizard then asks Ben same question.
What should he reply, and why?
- Ann replies: "Two."
Ben then says: "I know my number."
There are 3 possible numbers on Ben's forehead: what are they?
And what are the numbers in the bag?

Source: 1.
DansMath #158 and Sudipta Das, 2. Denis Borris

Solution

Mail to Ken