
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
Many residents of the city are involved in dancing, many in mathematics, and at least one in both. The number of those who are engaged only in dancing is exactly $p+1$ times more than those who are engaged 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 simultaneously interested in both mathematics and dancing?

Present the answer in LaTex format: \boxed{Your answer}
user