#OLD392. The Trouble Dinner
The Trouble Dinner
Description
In the gamble game, Melo won Elliott a lot of gold, so Melo decided to invite the whole acm-lab team to dinner. They went to a western restaurant, but they had a problem in ordering.
Each dish in the ordering system has a unique . When ordering, each character is input one by one, the system will check whether the dish exists in previous order history, and if it matches successfully, the system will order the previous dish again.
Obviously, it may result in ordering unnecessary dishes. If Melo has input the of all the dishes he want to order in the meal system in sequence. If Melo input the ID of all the dishes, anwser how many unnecessary dishes will be ordered.
Format
Input
The input contains multiple cases.
In each case, the first line contains a integer (), representing the number of dishes Melo want to order.
For the next lines each line has a number , representing the of each dish. ()
Output
Print the answer that number of extra dishes will are ordered.
Samples
5
1
10
12580
10086
10010
6
Hint
While input 10, the systems will order the dish whose is 1;
then input 12580, it will order 1 again;
input 10086 it will order 1 and 10 two dishes;
input 10010, it wil order 1 and 10 as above one. So the answer is 6.