Take the set of integers $\{0, 1, .., p-1\}$, square each element, you get the (smaller) set of quadratic residues. Repeat until you get a fix point set. The size of this set is a function of $p$. Does this function have a name? How can I efficiently calculate it?
Some values: $$f(3) = 2, \\ f(5) = 2,\\ f(7) = 4,\\ f(11) = 6,\\ f(13) = 4, \\ f(17) = 2,\\ f(19) = 10,\\ f(23) = 12,\\ f(29) = 8$$