Java
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    long totalNodes = 0;
	List<ArrayList> children = new ArrayList<>();
	long score = 0;
	int outputNodesCount = 0;

	
	public int countHighestScoreNodes(int[] parents) {
		totalNodes = parents.length;

		while (totalNodes >= 0) {
			children.add(new ArrayList());
			totalNodes -= 1;
		}

		totalNodes = parents.length;

		for (int i = 1; i < totalNodes; i++) {
			int tempParent = parents[i];
			List tempList = children.get(tempParent);
			tempList.add(i);
		}
		long max = navigate(parents, children, 0);

         System.out.print(score+",");
		
		return outputNodesCount;
	}

	public long navigate(int[] parents, List<ArrayList> children, int node) {
		ArrayList<Integer> childrenList = children.get(node);
		long childScoresSum = 0;		
		long childScoresProduct = 1;
		long tempChildCount = 0;

		if (childrenList == null || childrenList.size() == 0) {
			childScoresProduct = totalNodes - 1;
		} else {
			for (int child : childrenList) {
				tempChildCount = navigate(parents, children, child);
				childScoresProduct *= tempChildCount;
				childScoresSum += tempChildCount;
			}

			if (parents[node] >= 0) {
				long parentSubtree = Math.abs(totalNodes - childScoresSum - 1);
				childScoresProduct *= parentSubtree;
			}
		}

		if (score < childScoresProduct) {
			score = childScoresProduct;
			outputNodesCount = 1;
		} else if (score == childScoresProduct)
			outputNodesCount++;
		return childScoresSum+1;

	}
}
```
['Java']