Problem10273--CF EDU - Segment Tree P1 - Step 3 - C. Nested Segments

10273: CF EDU - Segment Tree P1 - Step 3 - C. Nested Segments

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 512 MiB

Description

Given an array of $2n$ numbers, each number from $1$ to $n$ in it occurs exactly twice. We say that the segment $y$ is nested inside the segment $x$ if both occurrences of the number $y$ are between the occurrences of the number $x$. Find for each segment $i$ how many segments that are nested inside it.

Input

The first line contains the number $n\ (1≤n≤10^5)$. 

The second line contains $2n$ numbers. It is guaranteed that every number from $1$ to $n$ occurs exactly twice.

Output

Print $n$ numbers, the $i$-th number is equal to the number of segments nested inside the segment $i$.

Sample 1 Input

5
5 1 2 2 3 1 3 4 5 4

Sample 1 Output

1 0 0 0 3 

HINT

CF EDU.

Source/Category