Simple Java Solution (DFS, Build Tree)
```\nclass Solution {\n    static class TreeNode {\n        int val;\n        TreeNode left,right;\n        TreeNode() {\n            \n        }\n        TreeN
```\nclass Solution {\n    static class TreeNode {\n        int val;\n        TreeNode left,right;\n        TreeNode() {\n            \n        }\n        TreeNode(int val) {\n            this.val=val;\n        }\n    }\n    public int countHighestScoreNodes(int[] parents) {\n        int n=parents.length;\n        HashMap<Integer,TreeNode> map=new HashMap<>();\n        for(int i=0;i<n;i++) {\n            map.put(i,new TreeNode(i));\n        }\n        TreeNode root=null;\n        for(int i=0;i<n;i++) {\n            if(parents[i]==-1) {\n                root=map.get(i);\n            }\n            else {\n                TreeNode parent=map.get(parents[i]);\n                TreeNode child=map.get(i);\n                if(parent.left==null) {\n                    parent.left=child;\n                }\n                else {\n                    parent.right=child;\n                }\n                    \n            }\n        }\n        Queue<Long> queue=new LinkedList<>();\n        getScore(root,queue,n);\n        long max=0;\n        int count=0;\n        while(n-->0) {\n            long temp=queue.poll();\n            max=Math.max(max,temp);\n            queue.offer(temp);\n        }\n        while(!queue.isEmpty()) {\n            if(max==queue.poll())\n                ++count;\n        }\n        return count;\n        \n        \n    }\n    long getScore(TreeNode root,Queue<Long> queue,int size) {\n        if(root==null)\n            return 0;\n        long left=getScore(root.left,queue,size);\n        long right=getScore(root.right,queue,size);\n        long up=size-left-right-1;\n        long temp=0;\n        if(left==0&&right==0&&up==0) {\n            temp=0;\n        }\n        else {\n            long tempLeft=left==0?1:left;\n            long tempRight=right==0?1:right;\n            up=up==0?1:up;\n            temp=tempLeft*tempRight*up;\n        }\n        \n        queue.offer(temp);\n        return 1+left+right;\n    }\n}
[]