A node is "good" if no node on the path from root to it has a greater value. Count good nodes. This is a top-down tree DP (pre-order).
Carry the maximum value seen on the path so far. At each node: if , it's good. Update for children. Unlike most tree DP which is bottom-up, this uses parent information, so it's top-down. The state flows from root to leaves.