36. Many city residents engage in dancing, many in mathematics, and at least one in both. Those who engage only in dancing are exactly $p+1$ times more than those who engage only in mathematics, where $p-$ is some prime number. If you square the number of all mathematicians, you get the number of all dancers. How many residents are interested in both mathematics and dancing at the same time?