#K90967. Grouping Consecutive Bird IDs

    ID: 37870 Type: Default 1000ms 256MiB

Grouping Consecutive Bird IDs

Grouping Consecutive Bird IDs

You are given a sequence of bird IDs. Your task is to group the consecutive identical numbers and output the sizes of these groups.

More formally, given an array \(A = [a_1, a_2, \dots, a_n]\), you need to form consecutive groups such that each group consists of consecutive equal elements. For each group, output its size.

For example, if \(A = [7, 7, 2, 2, 2, 8, 8, 1]\), then the groups are \([7, 7]\), \([2, 2, 2]\), \([8, 8]\), and \([1]\), and the answer is [2, 3, 2, 1].

inputFormat

The first line contains an integer \(n\) representing the number of bird IDs. The second line contains \(n\) integers separated by spaces representing the bird IDs.

If \(n = 0\), the list is empty.

outputFormat

Output a single line containing the sizes of the groups of consecutive identical bird IDs, separated by a single space. There should be no extra spaces at the beginning or end.

## sample
8
7 7 2 2 2 8 8 1
2 3 2 1