Problem list
Log in
#coci00461 · COCI 2017/2018 Contest 3

Aron

Bronze III 1.0 s 256 MB

The holiday season is near! Aron wants to get gifts for his friends in Zagreb, so in order to get them on time, he visited a famous toy store in London. After picking out the gifts, he went to the register and discovered that there were already $N$ people in line. Luckily, he noticed that there were groups of people standing in line, in addition to individual customers. A group of people consists of a customer and their friends waiting for them to complete the purchase. The moment when the customer is done, they and their friends leave the line. The people considered a group are standing one behind the other and are wearing shirts of matching colour. Two adjacent groups, adjacent individuals or adjacent individual and a group, will never be wearing shirts of the same colour. Write a program that will, given the data on the people standing in line, output which person in line Aron is.

Input

The first line of input contains the positive integer $N$ ($1 \le N \le 25$) from the task. Each of the following $N$ lines contains a single character, an uppercase letter of the English alphabet that represents the shirt colour of the $i^{th}$ person in line.

Output

You must output the required number from the task.

Example 1

Input
3
C
Z
P
Output
4

Example 2

Input
6
C
C
P
C
Z
Z
Output
5

Example 3

Input
6
B
B
B
B
B
B
Output
2
Source
COCI 2017/2018 Contest 3
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code