Let S(n) be the largest subset of Z(n) fixed by the mapping n -> n^2, and let f(n) = |Z(n)|. For example, S(25) = {0, 1, 6, 11, 16, 21} is the largest set of residues modulo 25 fixed by the mapping n -> n^2, so f(25) = |S(25)| = 6. Can you find a formula for f(n) in terms of n?