+ محدودیت زمان: ۱ ثانیه
+ محدودیت حافظه: ۲۵۶ مگابایت
----------
Colonelmo and CaptainH1 were hanging out at Cluna when they noticed something strange.
Cluna allows the customers to pay by credit card in a super secure way: The guy at the counter simply asks about your card's password. And if that isn't enough, he will shout it out as loud as possible after he hears it from you.
We know that there are $N$ people who are going to Cluna today, and the $i$-th person's credit card password is equal to $a_i,$ a $4$ digit number (possibly containing leading zeroes). We know that the people pay (and therefore tell their password) when they are about to leave the shop. We also have the customers' entrance/exit times. Since the guy at the counter repeats the password in a really loud voice, everybody present in the shop at that particular moment will hear it. A customer can memorize a password if and only if she is present at the shop while the cashier is shouting it and the password which is being told is similar to his own password. Two passwords are said to be similar if and only if one is a rearrangement of the digits of the other one ($1234$ is similar to say, $1234$ and $4132$ etc.).
As always, CaptainH1 is quite concerned about security matters. She asks Colonel, how many
passwords that belong to other people are known to each of the customers at the end? Colonel is too busy browsing 9gag and knows that CaptainH1 won't give him his kindersurprise if he doesn't answer in time. Can you help him?
# ورودی
The first line of input contains an integer $N$ and in the next line $N$ space separated Integers $a_1, a_2, \dots, a_N$.
$$ 1 \leq N \leq 2000$$
Next line contains an integer $M$ indicating total number of entrances/exists that have happened ordered by the time of happening.
$$ 0 \leq M \leq 2000$$
Each of following $M$ lines contains an integer $X$ denoting person $X$ will enter the shop if she is not in the shop, or otherwise she will pay and leave the shop.
$$ 1 \leq X \leq N$$
+ The same person can go to Cluna multiple times.
+ Initially there are no customers in Cluna.
# خروجی
Print $N$ space separated numbers $b_1, b_2, \dots , b_N$ each denoting the number of other people whose password is known to $i$-th person.
# مثالها
## ورودی نمونه ۱
```
5
1234 4321 2345 3455 5345
10
1
2
2
4
5
4
5
3
1
1
```
## خروجی نمونه ۱
```
1 0 0 0 1
```
+ Person one knows about person two's password.
+ Person five knows about person four's password.
Colonelmo, CaptainH1 and Cluna