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 2n integers x_1, x_2, ..., x_2n (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.


-----Examples-----
Input
1
1 1

Output
1

Input
3
2 1 1 3 2 3

Output
2



-----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.

Difficulty: interview

Starter code:

Solutions:
read = lambda: map(int, input().split())
n = int(input())
a = list(read())
was = [0] * (n + 1)
bal = ans = 0
for i in a:
    if was[i]:
        bal -= 1
    else:
        bal += 1
        was[i] = 1
    ans = max(ans, bal)
print(ans)

import math
import bisect
import itertools
import decimal

def ria():
    return [int(i) for i in input().split()]

st=set()
mx=0
n=ria()[0]

ar=ria()
for i in ar:
    if i not in st:
        st.add(i)
    else:
        st.remove(i)
    mx=max(len(st),mx)
print(mx)

n = int(input())
our = list(map(int, input().split()))
tab = set()
res = 0
for elem in our:
    if elem in tab:
        tab.discard(elem)
    else:
        tab.add(elem)
    res = max(res, len(tab))
print(res)

n = int(input())
used = [False for i in range(n + 2)]
arr = list(map(int, input().split()))
cnt = 0
maxx = 0
for i in range(2 * n):
    if used[arr[i]]:
        cnt -= 1
        used[arr[i]] = False
    else:
        used[arr[i]] = True
        cnt += 1
        maxx = max(maxx, cnt)
print(maxx)


n = int(input())

s = set()


l = list(map(int, input().split()))

cnt = 0
for x in l:
	if x in s:
		s.remove(x)
	else:
		s.add(x)
	cnt = max(cnt, len(s))

print(cnt)


n = int(input())
st = set()
ans = 0
for i in map(int, input().split()):
	if i not in st:
		st.add(i)
		ans = max(ans, len(st))
	else:
		st.remove(i)
print(ans)

n = int(input())
x = list(map(int, input().split()))

a = [0] * n
cur = 0
res = 0
for y in x:
    m = y - 1
    if a[m]:
        a[m] = 0
        cur -= 1
    else:
        a[m] = 1
        cur += 1
        res = max(res, cur)

print(res)


a = set()
n = int(input())
k = list(map(int, input().split()))
res = 0
for i in range (len(k)):
    if (k[i] in a):
        a.remove(k[i])
    else:
        a.add(k[i])
    res = max(res, len(a))
print(res)

n = int(input())
arr = list(map(int, input().split()))
used = [0 for i in range(n)]
cur = 0
maxn = -1
for i in range(2 * n):
    if used[arr[i] - 1] == 0:
        cur += 1
        used[arr[i] - 1] = 1
    else:
        used[arr[i] - 1] -= 1
        cur -= 1
    maxn = max(maxn, cur)
print(maxn)

n = int(input())
s = set()
ans = 0
for i in map(int, input().split()):
    ans = max(ans, len(s))
    if i in s:
        s -= set([i])
    else:
        s.add(i)
print(ans)

n = int(input())
socks = list(map(int, input().split()))
f = [0] * (n + 1)
cur = 0
ans = 0
for s in socks:
    if f[s] == 1:
        cur -= 1
    else:
        cur += 1
        f[s] = 1
    ans = max(ans, cur)
print(ans)

n = input()
l = list(map(int,input().split()))
s = set()
ans = 1
for i in l:
    s^={i}
    ans = max(ans,len(s))
print(ans)


#!/usr/bin/env python3
import sys
import os

N = int(input())
s = set()
v = list(map(int, input().split()))
ans = 0

for i in range(0,2*N):
  if v[i] in s:
    s.remove(v[i])
  else:
    s.add(v[i])
  ans = max(ans, len(s))

print(ans)


s = set()
n = int(input())
m = input()
m = m.split()
cnt = 0
max_cnt = 0
for i in range(len(m)):
    if m[i] in s:
        s.remove(m[i])
        cnt -= 1
    else:
        s.add(m[i])
        cnt += 1
        if cnt > max_cnt:
            max_cnt = cnt
print(max_cnt)


import sys

a = int(input().strip())
arr = [int(arr_temp) for arr_temp in input().strip().split(' ')]
# your code goes here
table = set([])
lenTabel = 0
for sock in arr:
    # print(table)
    if sock in table:
        table.remove(sock)
    else:
        table.add(sock)
        # print(table)
        # print("{} ini panjang".format(len(table)))
        lenTabel = len(table) if (len(table) > lenTabel) else lenTabel
print(lenTabel)


n=int(input())
stol=[0 for i in range(n)]
a=input().split()
m=0
k=0
for e in a:
    if stol[int(e)-1]==0:
        stol[int(e)-1]=1
        k+=1
        if k>m:
            m=k
    else:
        stol[int(e)-1]=0
        k-=1
print(m)

n=int(input())
stol=[0 for i in range(n)]
a=[int(s) for s in input().split()]
m=0
k=0
for e in a:
    if stol[e-1]==0:
        stol[e-1]=1
        k+=1
        if k>m:
            m=k
    else:
        stol[e-1]=0
        k-=1
print(m)

no_of_socks=int(input())
socks=[]
for i in range(no_of_socks+1):
    socks.append(0)
present=0
maximum=0
string = input()
i=0
while i<len(string):
    j=0
    if string[i]==" ":
        i+=1
    while string[i]!=" ":
       j*=10
       j+=int(string[i])
       i+=1
       if i==len(string):
           break
    socks[j]+=1
    present+=1
    if(socks[j]==2):
        present-=2
    if(maximum<present):
        maximum=present

print (maximum)

n = int(input())
l = list(map(int,input().split()))
t = []
for i in range(100001):
    t.append(0)
w = 0
F = 0
for i in l:
    t[i] += 1
    if t[i]==1:
        F += 1
    if w<F:
        w = F
    if t[i]==2:
        F -= 1
    if w<F:
        w = F
print(w)


n = int(input())
socks = [int(x) for x in input().split()]

on = set()
m = 0
i = 0
for s in socks:
    if s in on:
        m = max(m, i)
        i -= 1
    else:
        on.add(s)
        i += 1
print(max(m, i))
    


n = int(input())
max = 0
now = 0
arr = [False for i  in range(0, 2 * n)]
h = input().split(" ")
for k in range(0, 2 * n):
	if arr[int(h[k])] == False:
		arr[int(h[k])] = True
		now += 1
	else: 
		now -= 1
	if max < now:
		max = now
print(max)		

n=int(input())
sp=list(map(int,input().split()))
count=1
sont=set()
for x in sp:
    sont^={x}
    if len(sont)>count: count=len(sont)
print(count)

n = int(input())
x = map(int,input().split(' '))
ans = 0
y = set ()
for i in x:
    if i in y:
        y.remove(i)
    else:
        y.add(i)
    ans = max(ans,len(y))
print(ans)  

input()
sp=input().split()
count=1
sont=set()
for x in sp:
	sont^={x}
	l = len(sont)
	if l>count: count=l
print(count)