Please see the figure. Blastopore fate has changed multiple times, and it is not certain that these data will give the correct number of changes. However, the simplest/most parsimonious explanation is for the ancestral state to have been N. Then a change to P after Acoela branches off. Another change to D for the Deuterostomia branch, and one change each within the three phyla that have both P and D. This makes 5 changes at least.
Work Step by Step
Redraw the tree by simply removing all taxa and branch points not listed in the question. Then, add the N, P, and D designations. Try to imagine scenarios which would lead to this arrangement, and pick the one with the fewest changes in blastopore fate.