Problem:
Score : 300 points

Problem Statement

A company has N members, who are assigned ID numbers 1, ..., N.

Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.

When a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.

You are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.

Constraints

2 \leq N \leq 2 \times 10^5

1 \leq A_i < i

Input

Input is given from Standard Input in the following format:

N
A_2 ... A_N

Output

For each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.

Sample Input 1

5
1 1 2 2

Sample Output 1

2
2
0
0
0

The member numbered 1 has two immediate subordinates: the members numbered 2 and 3.

The member numbered 2 has two immediate subordinates: the members numbered 4 and 5.

The members numbered 3, 4, and 5 do not have immediate subordinates.

Sample Input 2

10
1 1 1 1 1 1 1 1 1

Sample Output 2

9
0
0
0
0
0
0
0
0
0

Sample Input 3

7
1 2 3 4 5 6

Sample Output 3

1
1
1
1
1
1
0

Solution in C# (.NET Core 3.1.201) (judge verdict: Wrong Answer)

using System;
using System.Collections;
using System.Collections.Generic;

namespace 練習問題
{
    class Program {
        static void Main(string[] args) {
            List<int> pattern = new List<int>();
            // List<int> zikan = new List<int>();
            int n = 0;
            // int m = 0;
            int judge = 0;
            string[] input;
            var sw = new System.Diagnostics.Stopwatch();
            debug Debug = new debug();
            List<int> addEqual = new List<int>();
            Dictionary<int,int> joushi = new Dictionary<int, int>();
            if (args.Length == 0){
                Debug.FlagFalse();
                string[] nminput = Console.ReadLine().Split(' ');
                n = int.Parse(nminput[0]);
                // m = int.Parse(nminput[1]);
                // c = int.Parse(Console.ReadLine());
                // string d = Console.ReadLine();
                input = Console.ReadLine().Split(' ');
            } else {
                Debug.FlagTrue();
                if (args[0] == "1"){
                    n = 5;
                    input = new string[4] {"1","1","2","2"};
                } else if (args[0] == "2"){
                    n = 10;
                    input = new string[9] {"1","1","1","1","1","1","1","1","1"};
                } else if (args [0] == "3"){
                    n = 7;
                    input = new string[6] {"1","2","3","4","5","6"};
                } else {
                    n = 2;
                    input = new string[1] {"1"};
                }
            }
            sw.Start(); //2秒以内ですねスタート
            bool addFlag = true;
            for (int i = 0; i < input.Length; i++) {
                addFlag = true;
                foreach (KeyValuePair<int,int> kvp in joushi) {
                    if (int.Parse(input[i]) == kvp.Key){
                        addFlag = false;
                    }
                }
                if (addFlag == true){
                    joushi.Add(int.Parse(input[i]),1);
                } else {
                    joushi[int.Parse(input[i])]++;
                }
            }
            int writeCount = 0;
            foreach (KeyValuePair<int,int> kvp in joushi) {
                Console.WriteLine(kvp.Value);
                writeCount++;
            }
            if (writeCount < n){
                // Debug.Log("if");
                for (int i = 0; i < n - writeCount; i++) {
                    Console.WriteLine(0);
                }
            }
            sw.Stop();
            TimeSpan ts = sw.Elapsed;
            Debug.Log($"{ts}");
        }
        
        static int intPow(int target,int kaisu){
            int startTarget = target;
            for (int i = 1; i < kaisu; i++)
            {
                target *= startTarget;
            }
            return target;
        }

        static void bubble_sort(List<List<int>> a) {
            int count=0;
            for (int i = 0; i < a.Count; i++) {
                for (int j = 0; j < a.Count-i-1; j++) {
                    // if (a[j] == a[a.Count - 1]){
                    //     continue;
                    // }
                    count++;
                    if (a[j][1] > a[j+1][1]){
                        int localsave = 0;
                        localsave = a[j+1][1];
                        a[j+1][1] = a[j][1];
                        a[j][1] = localsave;
                        localsave = a[j][0];
                        a[j][0] = a[j+1][0];
                        a[j+1][0] = localsave;
                    }
                }
                //debug(a,"途中" + i);
            }
            // debug(a,"result");
            //Console.WriteLine("回数"+count);
            for (int i = 0; i < a.Count; i++)
            {
                Console.WriteLine(a[i][0]+" "+a[i][1]);
            }
        }
        /* 標準入力と標準出力が使えるかのチェック
        static void echo() {
            string echotest = Console.ReadLine();
            Console.WriteLine(echotest);
        }

        static void HelloWorld(){
            Console.WriteLine("Hello World!");
        }
        */
    }

    public class debug{ //宣言時は、「 debug Debug = new debug(); 」推奨
        bool debug_flag = true;
        public void Log(string str){
            if (debug_flag == true){
                Console.WriteLine(str);
            }
        }
        public void Log(int str){
            if (debug_flag == true){
                Console.WriteLine(str);
            }
        }
        public void Log(float str){
            if (debug_flag == true){
                Console.WriteLine(str);
            }
        }
        public void Log(object obj){
            if (debug_flag == true){
                Console.WriteLine(obj);
            }
        }

        public void Log(int[] arr){
            if (debug_flag == true){
                Console.WriteLine(string.Join(",", arr));
            }
        }
        public void Log(string[] arr){
            if (debug_flag == true){
                Console.WriteLine(string.Join(",", arr));
            }
        }
        public void Log(List<int> arr){
            if (debug_flag == true){
                string shuturyoku = "";
                for (int i = 0; i < arr.Count; i++) {
                    shuturyoku += arr[i] + ",";
                }
                Console.WriteLine(shuturyoku.TrimEnd(','));
            }
        }

        public void Log(List<string> arr){
            if (debug_flag == true){
                string shuturyoku = "";
                for (int i = 0; i < arr.Count; i++) {
                    shuturyoku += arr[i] + ",";
                }
                Console.WriteLine(shuturyoku.TrimEnd(','));
            }
        }

        public void Log(List<float> arr){
            if (debug_flag == true){
                string shuturyoku = "";
                for (int i = 0; i < arr.Count; i++) {
                    shuturyoku += arr[i] + ",";
                }
                Console.WriteLine(shuturyoku.TrimEnd(','));
            }
        }
        public void Log(){
            if (debug_flag == true){
                Console.WriteLine("アタイイレナサイ");
            }
        }
        public void FlagFalse(){
            debug_flag = false;
        }
        public void FlagTrue(){
            debug_flag = true;
        }
    }
}