2347. 
Let be a positive integer. Bernardo and Silvia take turns writing and erasing numbers on a blackboard as follows: Bernardo starts by writing the smallest perfect square with digits. Every time Bernardo writes a number, Silvia erases the last digits of it. Bernardo then writes the next perfect square, Silvia erases the last digits of it, and this process continues until the last two numbers that remain on the board differ by at least 2. Let be the smallest positive integer not written on the board. For example, if , then the numbers that Bernardo writes are , and the numbers showing on the board after Silvia erases are and , and thus . What is the sum of the digits of ?
This problem is copyrighted by the American Mathematics Competitions.

Instructions for entering answers:
For questions or comments, please email markan@eudelic.com.