Технокубок 2017 - Финал (только для онсайт-финалистов)
A
Andryusha and Socks
Codeforces
800
原题
←B →
翻译中…

Andryusha is an orderly boy and likes to keep things in their place.

翻译中…

Today he faced a problem to put his socks in the wardrobe. He has $*n*$ distinct pairs of socks which are initially in a bag. The pairs are numbered from $1$ to $*n*$. Andryusha wants to put paired socks together and put them in the wardrobe. He takes the socks one by one from the bag, and for each sock he looks whether the pair of this sock has been already took out of the bag, or not. If not (that means the pair of this sock is still in the bag), he puts the current socks on the table in front of him. Otherwise, he puts both socks from the pair to the wardrobe.

翻译中…

Andryusha remembers the order in which he took the socks from the bag. Can you tell him what is the maximum number of socks that were on the table at the same time?

翻译中…

Input

翻译中…

The first line contains the single integer $*n*$ ($1 ≤ *n* ≤ 10^{5}$) — the number of sock pairs.

翻译中…

The second line contains $2*n*$ integers $*x*_{1}, *x*_{2}, ..., *x*_{2*n*}$ ($1 ≤ *x*_{*i*} ≤ *n*$), which describe the order in which Andryusha took the socks from the bag. More precisely, $*x*_{*i*}$ means that the $*i*$-th sock Andryusha took out was from pair $*x*_{*i*}$.

翻译中…

It is guaranteed that Andryusha took exactly two socks of each pair.

翻译中…

Output

翻译中…

Print single integer — the maximum number of socks that were on the table at the same time.

翻译中…

Note

翻译中…

In the first example Andryusha took a sock from the first pair and put it on the table. Then he took the next sock which is from the first pair as well, so he immediately puts both socks to the wardrobe. Thus, at most one sock was on the table at the same time.

翻译中…

In the second example Andryusha behaved as follows:

翻译中…
  • Initially the table was empty, he took out a sock from pair $2$ and put it on the table.
  • Sock $(2)$ was on the table. Andryusha took out a sock from pair $1$ and put it on the table.
  • Socks $(1, 2)$ were on the table. Andryusha took out a sock from pair $1$, and put this pair into the wardrobe.
  • Sock $(2)$ was on the table. Andryusha took out a sock from pair $3$ and put it on the table.
  • Socks $(2, 3)$ were on the table. Andryusha took out a sock from pair $2$, and put this pair into the wardrobe.
  • Sock $(3)$ was on the table. Andryusha took out a sock from pair $3$ and put this pair into the wardrobe.
翻译中…

Thus, at most two socks were on the table at the same time.

翻译中…

样例

Input #1
1
1 1
Output #1
1
InputCopy OutputCopy
Input #2
3
2 1 1 3 2 3
Output #2
2
InputCopy OutputCopy
题目信息
标签
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。