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: MEDIUM

Solutions:
n = int(input())
a = list(map(int, input().split()))
b = [0] * (n + 1)
c = 0
m = 0
for x in a:
	b[x] = (b[x] + 1) % 2
	c += (-1, 1)[b[x]]
	m = max(m, c)
print(m)


n = int(input())
l = list(map(int, input().split()))
st = set()
cnt = ans = 0
for i in l:
	if i in st:
		cnt -= 1
	else:
		st.add(i)
		cnt += 1
		ans = max(cnt, ans)
print(ans)


(a, c, v) = ([False] * (int(input()) + 1), 0, 0)
for x in map(int, input().split()):
	c += (-1) ** a[x]
	v = max(v, c)
	a[x] = not a[x]
print(v)


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


tmp = {}
Max = 0
c = 0
input()
l = [*map(int, input().split())]
for i in l:
	if tmp.get(i, -1) == -1:
		tmp[i] = 1
		c += 1
		if c > Max:
			Max = c
	else:
		tmp[i] = -1
		c -= 1
print(Max)


n = int(input())
s = [int(i) for i in input().split()]
e = set()
d = []
c = 0
for i in range(2 * n):
	if s[i] in e:
		d.append(c)
		c -= 1
	else:
		e.add(s[i])
		c += 1
print(max(d))


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 = 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)


t = int(input())
l = list(map(int, input().split()))
se = set()
ans = 0
for i in range(len(l)):
	sdf = len(se)
	se.add(l[i])
	nlen = len(se)
	if nlen == sdf:
		se.remove(l[i])
	ans = max(ans, len(se))
print(ans)


n = int(input())
a = list(map(int, input().split()))
ans = 0
emp = set()
for i in a:
	emp ^= {i}
	if len(emp) > ans:
		ans = len(emp)
print(ans)


n = int(input())
c = list(map(int, input().split()))
p = set()
l = 0
m = 0
for i in range(2 * n):
	if c[i] in p:
		m = max(l, m)
		l -= 1
	else:
		p.add(c[i])
		l += 1
print(m)


n = int(input())
ar = [int(i) for i in input().split()]
w = [0] * (n + 1)
ans = 0
t = 0
for i in ar:
	if w[i]:
		t -= 1
	else:
		t += 1
		w[i] = 1
	ans = max(t, ans)
print(ans)


def solve(t_id):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	d = {}
	for x in a:
		if x in d:
			del d[x]
		else:
			d[x] = 1
		ans = max(ans, len(d))
	print(ans)
t = 1
for t_id in range(1, t + 1):
	solve(t_id)
	t -= 1


n = int(input())
a = [False] * n
x = list(map(int, input().split()))
cnt = 0
ans = 0
for y in x:
	y -= 1
	if a[y]:
		cnt -= 1
	else:
		cnt += 1
	a[y] = True
	ans = max(ans, cnt)
print(ans)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
li = inlt()
cnt = 0
ans = 0
dp = [0] * (n + 1)
for i in li:
	if dp[i] == 0:
		cnt = cnt + 1
		dp[i] = 1
	else:
		cnt = cnt - 1
	ans = max(ans, cnt)
print(ans)


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())
socks = 2 * n
max = 1
count = 1
a = [int(a_temp) for a_temp in input().strip().split(' ')]
table = {a[0]}
for i in range(1, socks - 1):
	s = a[i]
	if s in table:
		count -= 1
		table.remove(s)
	else:
		table.add(s)
		count += 1
		if count > max:
			max = count
print(max)


def andrey(lst):
	(a, result) = (set(), 0)
	for elem in lst:
		if elem not in a:
			a.add(elem)
			result = max(result, len(a))
		else:
			a.remove(elem)
	return result
n = int(input())
b = [int(i) for i in input().split()]
print(andrey(b))


n = int(input())
d = []
d += [int(x) for x in input().split()]
c = [0 for x in range(n + 1)]
stol = 0
maxx = 0
for x in range(2 * n):
	if c[d[x]] == 0:
		stol += 1
		if stol > maxx:
			maxx = stol
		c[d[x]] = 1
	else:
		stol -= 1
print(maxx)


n = int(input().strip())
tSocks = input().strip().split()
Table = [0] * n
Max = 0
Number = 0
for s in tSocks:
	s = int(s) - 1
	if Table[s] == 0:
		Table[s] = 1
		Number += 1
		if Number > Max:
			Max = Number
	else:
		Table[s] = 0
		Number -= 1
		if Number > Max:
			Max = Number
print(Max)


import sys
a = int(input().strip())
arr = [int(arr_temp) for arr_temp in input().strip().split(' ')]
table = set([])
lenTabel = 0
for sock in arr:
	if sock in table:
		table.remove(sock)
	else:
		table.add(sock)
		lenTabel = len(table) if len(table) > lenTabel else lenTabel
print(lenTabel)


n = int(input())
l = list(map(int, input().split()))
a = set()
c = 0
res = []
for i in range(2 * n):
	a.add(l[i])
	if c < len(a):
		c += 1
	else:
		a.discard(l[i])
		res.append(c)
		c = len(a)
print(max(res))


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


n = int(input())
socks = input().split()
socks_on_table = {}
result = 0
for elem in socks:
	if socks_on_table.pop(elem, 0):
		pass
	else:
		socks_on_table[elem] = 1
	result = max(result, len(socks_on_table))
print(result)


input()
h = input().split()
s = set()
m = 0
for i in h:
	s ^= {i}
	if len(s) > m:
		m = len(s)
print(m)


x = int(input())
a = list(map(int, input().split()))
d = {}
t1 = []
t = 0
for i in range(len(a)):
	if a[i] in d:
		t = t - 1
	else:
		d[a[i]] = 1
		t = t + 1
	t1.append(t)
print(max(t1))


n = int(input())
l = list(map(int, input().split()))
s = set()
maxlen = 0
for i in l:
	if i in s:
		s.remove(i)
	else:
		s.add(i)
	maxlen = max(maxlen, len(s))
print(maxlen)


import sys

def main():
	(_, *l) = map(int, sys.stdin.read().strip().split())
	(s, c, m) = (set(), 0, 0)
	for i in l:
		if i in s:
			s.remove(i)
			if m < c:
				m = c
			c -= 1
		else:
			s.add(i)
			c += 1
	return m
print(main())


n = int(input())
x = list(map(int, input().split()))
a = (10 ** 5 + 2) * [0]
cnt = 0
max_cnt = 0
for i in range(2 * n):
	a[x[i]] += 1
	if a[x[i]] == 1:
		cnt += 1
		if cnt > max_cnt:
			max_cnt = cnt
	else:
		cnt -= 1
	if i == n - 1:
		max_cnt = max(cnt, max_cnt)
print(max_cnt)


from math import *
from sys import *
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
d = {}
x = 0
ans = []
for i in range(2 * n):
	ans.append(x)
	if a[i] in d:
		x -= 1
	else:
		d[a[i]] = 1
		x += 1
ans.append(x)
print(max(ans))


n = int(input())
soc = list(map(int, input().split()))
b = set()
cnt = 0
res = 0
for s in soc:
	if s in b:
		b.remove(s)
		cnt -= 1
	else:
		b.add(s)
		cnt += 1
	res = max(res, cnt)
print(res)


n = int(input())
l = map(int, input().split())
(s, c) = (set(), 0)
for x in l:
	if x not in s:
		s.add(x)
	else:
		s.remove(x)
	c = max(c, len(s))
print(c)


N = int(input())
ls = list(map(int, input().split()))
d = {}
Max = 0
cnt = 0
for i in ls:
	try:
		if d[i] == True:
			Max = max(Max, cnt)
			cnt -= 1
	except:
		d[i] = True
		cnt += 1
print(Max)


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


import sys
input = sys.stdin.readline
ins = lambda : input().rstrip()
ini = lambda : int(input().rstrip())
inm = lambda : map(int, input().rstrip().split())
inl = lambda : list(map(int, input().split()))
out = lambda x, s='\n': print(s.join(map(str, x)))
n = ini()
a = inl()
ans = 0
table = [0] * (10 ** 5 + 1)
table_len = 0
for i in a:
	if table[i] == 0:
		table[i] = 1
		table_len += 1
	else:
		table_len -= 1
	ans = max(ans, table_len)
print(ans)


(n, ans, stack, s) = (int(input()), 0, 0, set())
for i in input().split():
	if not i in s:
		stack += 1
	else:
		stack -= 1
	ans = max(ans, stack)
	s.add(i)
print(ans)


n = int(input())
socks = list(map(int, input().split()))
total = 0
m = 0
seen = set()
for x in socks:
	if x in seen:
		m = max(m, total)
		total -= 1
	else:
		total += 1
		seen.add(x)
m = max(m, total)
print(m)


n = int(input())
socks = list(map(int, input().split()))
visited = {}
count = 0
result = []
for val in socks:
	visited[val] = 0
for val in socks:
	if visited[val] == 1:
		visited[val] = 0
		count -= 1
		result.append(count)
	else:
		visited[val] = 1
		count += 1
		result.append(count)
print(max(result))


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


n = int(input())
socks = map(int, input().split())
singles = set()
max_len = 0
for sock in socks:
	if not sock in singles:
		singles.add(sock)
	else:
		singles.remove(sock)
	max_len = max(max_len, len(singles))
print(max_len)


a = int(input())
b = list(map(int, input().split()))
cnt = 0
x = set()
y = []
for i in b:
	x ^= {i}
	if len(x) > cnt:
		cnt = len(x)
print(cnt)


n = input()
arr = input().split()
s = set()
cnt = 0
max_cnt = 0
for a in arr:
	if a in s:
		cnt -= 1
		s.remove(a)
	else:
		s.add(a)
		cnt += 1
		if cnt > max_cnt:
			max_cnt = cnt
print(max_cnt)


n = int(input())
a = list(map(int, input().split()))
m = 0
d = {}
for i in range(2 * n):
	if a[i] in d:
		del d[a[i]]
	else:
		d[a[i]] = 1
	m = max(m, len(d))
print(m)


n = int(input())
socks = list(map(int, input().split()))
sockP = []
for i in range(100000):
	sockP.append(0)
x = 0
xMax = 0
for i in socks:
	if sockP[i - 1] == 1:
		if xMax < x:
			xMax = x
		x -= 1
	else:
		sockP[i - 1] = 1
		x += 1
print(xMax)


n = int(input())
t = set()
max_size = 0
for item in [int(item) for item in input().split(' ')]:
	if item in t:
		t.remove(item)
	else:
		t.add(item)
	max_size = max(max_size, len(t))
print(max_size)


n = int(input())
a = list(map(int, input().split()))
myset = set()
ans = 1
for x in a:
	if x not in myset:
		myset.add(x)
		ans = max(ans, len(myset))
	else:
		myset.remove(x)
print(ans)


n = int(input())
A = list(map(int, input().split()))
c = set()
ans = 1
for i in A:
	if i in c:
		c.discard(i)
	else:
		c.add(i)
	ans = max(ans, len(c))
print(ans)


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)


import math
n = int(input())
myArray = list(map(int, input().split()))
myMap = dict()
myMap[myArray[0]] = 1
length = 1
for i in range(1, len(myArray)):
	if myMap.get(myArray[i]) == None:
		myMap[myArray[i]] = 1
		length = max(length, len(myMap))
	else:
		del myMap[myArray[i]]
print(length)


def mo(x, y):
	if x < y:
		x = y
	return x

def myfunc(l1):
	c = set(l1)
	i = 0
	while i < len(l1):
		if l1[i] in c:
			c.remove(l1[i])
			l1[i] = 1
		else:
			l1[i] = -1
		i += 1
	return l1

def counter(l2):
	temp = 0
	ans = 0
	i = 0
	while i < len(l2):
		temp += int(l2[i])
		ans = mo(ans, temp)
		i += 1
	return ans

def answer():
	a = int(input())
	print(counter(myfunc(input().split())))
answer()


n = int(input())
q = [int(x) for x in input().split()]
ans = -n
s = set()
size = 0
for i in range(2 * n):
	temp = q[i]
	if temp in s:
		s.remove(temp)
		size -= 1
	else:
		s.add(temp)
		size += 1
	ans = max(ans, size)
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
(ans, t) = (0, 0)
b = [0 for i in range(n)]
for x in a:
	if b[x - 1]:
		b[x - 1] -= 1
		t -= 1
	else:
		b[x - 1] += 1
		t += 1
		if t > ans:
			ans = t
print(ans)


n = int(input())
a = list(map(int, input().split()))
c = 0
s = set()
max1 = -float('inf')
for i in range(2 * n):
	if a[i] not in s:
		s.add(a[i])
		c += 1
	else:
		if c > max1:
			max1 = c
		c = c - 1
		s.discard(a[i])
print(max1)


def main():
	n = int(input())
	A = list(map(int, input().split()))
	B = [0 for i in range(n + 10)]
	ans = 0
	cnt = 0
	for x in A:
		if B[x] == 0:
			B[x] = 1
			cnt += 1
		else:
			B[x] = 0
			cnt -= 1
		ans = max(ans, cnt)
	print(ans)
	return 0
main()


n = int(input())
x = list(map(int, input().split()))
table = set()
maxsocks = 0
socks = 0
for i in x:
	if i not in table:
		table.add(i)
		socks += 1
	else:
		socks -= 1
	if socks > maxsocks:
		maxsocks = socks
print(maxsocks)


n = int(input())
a = list(map(int, input().split()))
table = [0] * n
m = c = 0
for i in a:
	if not table[i - 1]:
		table[i - 1] += 1
		c += 1
	else:
		table[i - 1] -= 1
		c -= 1
	if c >= m:
		m = c
print(m)


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


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


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)


x = int(input())
a = list(map(int, input().split()))
p = 0
mx = 0
y = [0 for i in range(x)]
for i in range(x * 2):
	y[a[i] - 1] += 1
	if y[a[i] - 1] == 2:
		p -= 1
	else:
		p += 1
		mx = max(mx, p)
print(mx)


def main():
	n = 2 * int(input())
	nums = list(map(int, input().split(' ')))
	ret = 0
	s = set()
	for num in nums:
		if num in s:
			s.remove(num)
		else:
			s.add(num)
		ret = max(ret, len(s))
	return ret
print(main())


n = input()
x = set()
c = 0
for i in input().split():
	x ^= {i}
	c = max(len(x), c)
print(c)


n = int(input())
x = [int(i) for i in input().split()]
w = set([])
ans = c = 0
for i in x:
	if i in w:
		c -= 1
	else:
		c += 1
		w.add(i)
		ans = max(ans, c)
print(ans)


n = int(input())
s = set()
m = 0
for i in input().split():
	if i in s:
		s.remove(i)
	else:
		s.add(i)
	m = max(len(s), m)
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)


num = int(input())
arr = list(map(int, input().split()))
table = set()
ct = 0
mx = 0
for sock in arr:
	if sock not in table:
		table.add(sock)
		ct += 1
	else:
		ct -= 1
	mx = max(ct, mx)
print(mx)


(tmp, _) = (set(), input())
print(max(((tmp.remove(x) if x in tmp else tmp.add(x), len(tmp))[1] for x in map(int, input().split(' ')))))


def socks(arr):
	table = set()
	n = 0
	ans = 0
	for i in arr:
		if i in table:
			table.remove(i)
			n -= 1
		else:
			table.add(i)
			n += 1
		ans = max(ans, n)
	return ans
n = int(input())
arr = list(map(int, input().strip().split()))
print(socks(arr))


n = int(input())
m = list(map(int, input().strip().split()[:2 * n]))
t = set()
k = []
count = 0
for x in m:
	if x not in t:
		t.add(x)
		count = max(count, len(t))
	else:
		t.remove(x)
print(count)


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


n = int(input())
a = [int(i) for i in input().split()]
q = [0] * n
z = 0
k = 0
for i in range(2 * n):
	if q[a[i] - 1] == 0:
		q[a[i] - 1] = 1
		k += 1
		if k > z:
			z = k
	else:
		q[a[i] - 1] = 0
		k -= 1
print(z)


input()
a = set()
r = 0
for x in input().split():
	a ^= {x}
	r = max(r, len(a))
print(r)


input()
(socks, max_socks) = (set(), 0)
for x in input().split():
	socks ^= {x}
	max_socks = max(len(socks), max_socks)
print(max_socks)


input()
X = list(map(int, input().split()))
Y = [False for i in range(len(X))]
Max = 0
N = 0
for i in X:
	if Y[i - 1]:
		N -= 1
	else:
		Y[i - 1] = True
		N += 1
		Max = max(N, Max)
print(Max)


n = int(input()) >> 1
found = {}
r = c = 0
for x in input().split():
	if x in found:
		c -= 1
	else:
		found[x] = 1
		c += 1
	r = max(r, c)
print(r)


n = int(input())
p = list(map(int, input().split()))
(k, d) = (0, {})
for i in range(2 * n):
	if p[i] in d:
		del d[p[i]]
	else:
		d[p[i]] = 1
	k = max(k, len(d))
print(max(k, len(d)))


def socks():
	n = int(input())
	arr = [False for _ in range(n + 1)]
	pairs = list(map(int, input().split()))
	count = 0
	max_count = 0
	for p in pairs:
		if arr[p]:
			count -= 1
		else:
			arr[p] = True
			count += 1
			max_count = max(count, max_count)
	print(max_count)
socks()


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	l = LI()
	d = {}
	ans = 0
	tmp_ans = 0
	for x in l:
		if x in d:
			tmp_ans -= 1
			d.pop(x)
		else:
			tmp_ans += 1
			ans = max(ans, tmp_ans)
			d[x] = x
	return ans
print(main())


NumOfSocks = int(input())
Socks = [int(x) for x in input().split()]
(OnTable, maxSocks, tmpMaxSocks) = ([0] * (NumOfSocks + 1), 0, 0)
for i in Socks:
	if not OnTable[i]:
		OnTable[i] = 1
		tmpMaxSocks += 1
	else:
		OnTable[i] = 0
		tmpMaxSocks -= 1
	if tmpMaxSocks > maxSocks:
		maxSocks = tmpMaxSocks
print(maxSocks)


from collections import Counter

def func():
	n = int(input())
	l = list(map(int, input().split()))
	k = {}
	m = 0
	for i in l:
		if i in k:
			del k[i]
		else:
			k[i] = 1
		if len(k) > m:
			m = len(k)
	print(m)
t = 1
for i in range(t):
	func()


input()
socks_in_package = input().split()
(socks_on_table, max_socks_on_table) = (set(), 0)
for sock in socks_in_package:
	socks_on_table ^= {sock}
	max_socks_on_table = max(max_socks_on_table, len(socks_on_table))
print(max_socks_on_table)


t = int(input())
a = list(map(int, input().split()))
st = 0
mst = 0
i = 0
y = set()
while i < 2 * t:
	if a[i] in y:
		if mst <= st:
			mst = st
			st -= 1
		else:
			st -= 1
		y.remove(a[i])
	else:
		y.add(a[i])
		st += 1
	i += 1
print(mst)


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())
s = map(int, input().split())
lis = {}
ma = 0
inMax = 0
for i in s:
	if i not in lis:
		lis[i] = 1
		inMax += 1
	else:
		inMax -= 1
	if inMax > ma:
		ma = inMax
print(ma)


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())
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())
l = list(map(int, input().split()))
a = [0] * (n + 1)
m = 0
ans = 0
for i in range(2 * n):
	if a[l[i]] == 0:
		m -= -1
		a[l[i]] = 1
	elif a[l[i]] == 1:
		m += -1
		a[l[i]] = 2
	ans = max(ans, m)
print(ans)


n = int(input())
s = set()
_max = 0
new_max = 0
for inp in map(int, input().split()):
	if inp in s:
		s.remove(inp)
	else:
		s.add(inp)
	new_max = len(s)
	if new_max > _max:
		_max = new_max
print(_max)


n = int(input())
x = list(map(int, input().split(' ')))
(table, result) = (set(), 0)
for p in x:
	if p not in table:
		table.add(p)
		result = max(result, len(table))
	else:
		table.remove(p)
print(result)


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)


def main():
	n_socks = int(input())
	table = {}
	max_table_length = 0
	for i in input().split():
		if i in table:
			del table[i]
		else:
			table[i] = True
			if len(table) > max_table_length:
				max_table_length = len(table)
	print(max_table_length)
main()


num_sock_pairs = int(input())
sock_pairs = list(map(int, input().split()))
visited = [0] * num_sock_pairs
holder = 0
size = 0
for a in sock_pairs:
	if visited[a - 1] == 1:
		size = size - 1
	else:
		visited[a - 1] = 1
		size = size + 1
	if size > holder:
		holder = size
print(holder)


n = int(input())
(ans, cnt, ind) = (0, 0, 0)
a = list(map(int, input().split()))
map = dict()
for x in a:
	if x not in map:
		map[x] = ind
		cnt += 1
	else:
		cnt -= 1
	ans = max(cnt, ans)
	ind += 1
print(ans)


import sys
import math
import bisect
import itertools

def main():
	s = set()
	max_val = 0
	n = int(input())
	for a in list(map(int, input().split())):
		if a not in s:
			s.add(a)
			max_val = max(max_val, len(s))
		else:
			s.remove(a)
	print(max_val)
main()


n = input()
n = [int(s) for s in input().split()]
a = set()
sum = 0
max = 0
for i in n:
	if i in a:
		a.remove(i)
		sum -= 1
	else:
		a.add(i)
		sum += 1
		if sum > max:
			max = sum
print(max)


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)


input()
a = set()
r = 0
for x in map(int, input().split()):
	if x in a:
		a -= {x}
	else:
		a |= {x}
	r = max(r, len(a))
print(r)


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())
l = set()
r = 0
for i in map(int, input().split()):
	if i not in l:
		l.add(i)
		r = max(r, len(l))
	else:
		l.remove(i)
print(r)


n = int(input())
max_socks = 0
table = set()
for sock in input().split():
	if sock in table:
		table.remove(sock)
	else:
		table.add(sock)
		max_socks = max(max_socks, len(table))
print(max_socks)


n = int(input())
olist = [int(x) for x in input().split(' ')]
sdic = {}
ans = 0
anslist = []
for i in range(1, n + 1):
	sdic[i] = 0
for i in olist:
	if sdic[i] == 0:
		sdic[i] = 1
		ans += 1
		anslist.append(ans)
	else:
		ans -= 1
		anslist.append(ans)
print(max(anslist))


n = int(input())
a = list(map(int, input().split(' ')))
table = 0
r = 0
map = {}
for i in range(len(a)):
	if a[i] not in map:
		map[a[i]] = 1
		table = table + 1
	elif a[i] in map:
		map[a[i]] = map[a[i]] - 1
		table = table - 1
	r = max(table, r)
print(r)


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())
l = map(int, input().split())
s = {}
c = 0
a = []
for i in l:
	if i not in s:
		s[i] = 1
		c += 1
	else:
		c -= 1
	a.append(c)
print(max(a))


n = int(input())
l = list(map(int, input().split()))
t = [0] * 100000
c = 0
sum = 0
for i in l:
	t[i - 1] += 1
	if t[i - 1] == 1:
		sum += 1
	else:
		sum -= 1
	c = max(c, sum)
print(c)


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


n = int(input())
t = [int(x) for x in input().split()]
res = 0
l = 0
p = [0]
for i in range(1, n + 1):
	p += [0]
for i in range(n * 2):
	if p[t[i]] == 0:
		l = l + 1
		res = max(res, l)
		p[t[i]] = 1
	else:
		l = l - 1
print(res)


n = int(input())
q = [int(x) for x in input().split()]
ans = -n
s = set()
for i in range(2 * n):
	temp = q[i]
	if temp in s:
		s.remove(temp)
	else:
		s.add(temp)
	ans = max(ans, len(s))
print(ans)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	a = LI()
	s = set()
	r = 0
	for c in a:
		if c in s:
			s.remove(c)
		else:
			s.add(c)
			if r < len(s):
				r = len(s)
	return r
print(main())


n = int(input().strip())
mm = list(map(int, input().split()))
l = [0] * (n + 1)
k = 0
ll = 0
for i in mm:
	if l[i] == 0:
		ll += 1
		l[i] = 1
	else:
		k = max(ll, k)
		ll -= 1
print(k)


nb_pair = int(input())
drawn = [int(x) for x in input().split()]
maxs = 1
table = set()
for i in drawn:
	table ^= {i}
	maxs = max(maxs, len(table))
print(maxs)


n = int(input())
a = list(map(int, input().split()))
b = {}
c = 0
x = 0
for i in range(2 * n):
	if not b.get(a[i]):
		b[a[i]] = True
		x += 1
	else:
		b.pop(a[i])
		x -= 1
	if x > c:
		c = x
print(c)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
n = get_int()
lst = get_int_list()
s = set()
count = mx = 0
for i in lst:
	if i in s:
		count -= 1
	else:
		count += 1
		s.add(i)
		mx = max(mx, count)
print(mx)


n = input()
arr = list(map(int, input().split()))
table = set()
maxim = 0
for i in arr:
	table ^= {i}
	if len(table) > maxim:
		maxim = len(table)
print(maxim)


n = int(input())
li = list(input().split())
gi = []
ki = set()
m = 0
for i in range(len(li)):
	if li[i] in ki:
		ki.remove(li[i])
	else:
		ki.add(li[i])
	m = max(m, len(ki))
print(m)


n = int(input())
a = [int(x) for x in input().split()]
maxn = maxans = 0
used = [True] * n
for i in range(n * 2):
	if used[a[i] - 1]:
		used[a[i] - 1] = False
		maxn += 1
	elif not used[a[i] - 1]:
		maxn -= 1
	if maxn > maxans:
		maxans = maxn
print(maxans)


n = int(input())
a = [int(i) for i in input().split()]
onta = set([])
l = []
d = 0
for i in a:
	if i not in onta:
		onta.add(i)
	else:
		onta.remove(i)
	t = len(onta)
	if t > d:
		d = t
print(d)


n = int(input())
l = list(map(int, input().split()))
table = [0] * (n + 1)
cnt = []
x = 0
for i in l:
	if table[i] == 0:
		table[i] += 1
		x += 1
	else:
		cnt.append(x)
		x -= 1
print(max(cnt))


n = int(input())
n = 2 * n
pairs = [int(i) for i in input().split()]
paired = [0 for i in range(n // 2)]
out = 0
maximum = 0
for i in range(n):
	if paired[pairs[i] - 1] == 0:
		paired[pairs[i] - 1] = 1
		out += 1
	elif paired[pairs[i] - 1] == 1:
		paired[pairs[i] - 1] == 2
		out -= 1
	if out > maximum:
		maximum = out
print(maximum)


int(input())
d = list(map(int, input().split()))
maxResult = 0
temp = {}
for n in d:
	if n not in temp:
		temp[n] = 1
		if maxResult < len(temp):
			maxResult = len(temp)
	else:
		del temp[n]
print(maxResult)


s = set()
res = 0
n = int(input())
aa = list(map(int, input().split()))
for a in aa:
	if a in s:
		s.remove(a)
	else:
		s.add(a)
		res = max(res, len(s))
print(res)


n = int(input())
a = [0] * (n + 2)
m = 0
now = 0
x = list(map(int, input().split()))
for i in range(2 * n):
	if a[x[i]] == 0:
		a[x[i]] = 1
		now += 1
		m = max(m, now)
	else:
		now -= 1
		a[x[i]] = 0
print(m)


n = int(input())
y = [int(x) for x in input().split()]
maximum = 0
s = set()
for i in y:
	if i in s:
		s.remove(i)
	else:
		s.add(i)
	maximum = max(maximum, len(s))
print(maximum)


(n, s, b, count, Max) = (int(input()), list(map(int, input().split())), set(), 0, 0)
for i in s:
	if i in b:
		count -= 1
	else:
		count += 1
	b.add(i)
	Max = max(Max, count)
print(Max)


from operator import itemgetter
n = int(input())
xi = list(map(int, input().split()))
ans = 0
num = 0
ai = [0] * (n + 1)
for i in range(2 * n):
	num += 1 - ai[xi[i]] * 2
	ai[xi[i]] ^= 1
	ans = max(ans, num)
print(ans)


n = int(input())
socks = list(map(int, input().split()))
d = {}
max = 0
for x in socks:
	if x in d:
		if len(d) > max:
			max = len(d)
		d.pop(x)
	else:
		d[x] = None
print(max)


n = int(input())
nums = [int(j) for j in input().split()]
freq = n * [0]
(output, table) = (0, 0)
for j in range(n * 2):
	if freq[nums[j] - 1] == 0:
		table += 1
		freq[nums[j] - 1] = 1
	else:
		table -= 1
	output = max(output, table)
print(output)


a = int(input())
wyn = 0
k = 0
d = []
t = []
t += [int(x) for x in input().split()]
for x in range(2 * a):
	d += [0]
for x in range(2 * a):
	if d[t[x]] == 0:
		d[t[x]] += 1
		wyn += 1
		k = max(k, wyn)
	else:
		wyn -= 1
print(k)


input()
res = 0
s = set()
for el in input().split():
	if el in s:
		s.remove(el)
	else:
		s.add(el)
		res = max(res, len(s))
print(res)


n = int(input())
numbers = map(int, input().split())
socks = set()
out = 0
m = 0
for i in numbers:
	if i in socks:
		out -= 1
	else:
		out += 1
		socks.add(i)
	m = max(m, out)
print(m)


n = int(input())
a = input().split()
max_cnt = 0
d = {}
for i in range(2 * n):
	if a[i] in d:
		del d[a[i]]
	else:
		d[a[i]] = 1
		if max_cnt < len(d):
			max_cnt = len(d)
print(max_cnt)


n = int(input())
b = list(map(int, input().split()))
v = set()
(z, q) = (1, 0)
for i in b:
	if i not in v:
		v.add(i)
		q += 1
	else:
		q -= 1
	z = max(z, q)
print(z)


n = int(input())
ar = list(map(int, input().split()))
table = [0] * (n + 1)
rez = 0
cur = 0
for i in ar:
	if table[i]:
		rez = max(rez, cur)
		cur -= 1
	else:
		table[i] += 1
		cur += 1
print(rez)


input()
sock = map(int, input().split())
table = set()
ans = 0
for s in sock:
	if s not in table:
		table.add(s)
	else:
		table.remove(s)
	ans = max(ans, len(table))
print(ans)


input()
(socks, max_socks) = (set(), 0)
for x in input().split():
	if x in socks:
		socks.remove(x)
	else:
		socks.add(x)
		max_socks = max(len(socks), max_socks)
print(max_socks)


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


n = int(input())
mas = list(map(int, input().split()))
check = [0 for i in range(n)]
ch = 0
ans = 0
for i in range(2 * n):
	check[mas[i] - 1] += 1
	if check[mas[i] - 1] == 2:
		ch -= 1
	else:
		ch += 1
	ans = max(ans, ch)
print(ans)


import sys
n = int(input())
x = list(map(int, input().split()))
store = [0] * (n + 1)
table = 0
maximum = 0
for i in range(len(x)):
	if store[x[i]] == 0:
		table += 1
		if table > maximum:
			maximum = table
		store[x[i]] = 1
	else:
		table -= 1
		store[x[i]] = 2
print(maximum)


n = int(input())
t = [int(x) for x in input().split()]
wyn = 0
l = 0
p = [0]
for i in range(1, n + 1):
	p += [0]
for i in range(2 * n):
	if p[t[i]] == 0:
		l += 1
		p[t[i]] = 1
		wyn = max(wyn, l)
	elif p[t[i]] == 1:
		l -= 1
print(wyn)


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


t = int(input())
order = map(int, input().split())
dd = {}
akt = 0
mx = 0
for v in order:
	if dd.get(v) == None:
		dd[v] = 1
		akt += 1
		mx = max(mx, akt)
	else:
		dd[v] = -1
		akt -= 1
print(mx)


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


n = int(input())
x = list(map(int, input().split()))
t = []
for i in range(n):
	t.append(0)
c = 0
p = 0
for i in x:
	if t[i - 1] != 1:
		t[i - 1] = 1
		c += 1
	else:
		if c > p:
			p = c
		c -= 1
print(p)


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())
(a, count, ans, b) = (list(map(int, input().split())), 0, 1, [False] * n)
for i in a:
	if b[i - 1] == False:
		b[i - 1] = True
		count += 1
	else:
		b[i - 1] = False
		count -= 1
	if count > ans:
		ans = count
print(ans)


from sys import stdin
n = int(input())
stacklen = 0
maxstack = 0
stack = set()
for _ in range(2 * n):
	ch = stdin.read(1)
	num = ''
	while ch not in (' ', '\n'):
		num += ch
		ch = stdin.read(1)
	num = int(num)
	if num in stack:
		stack.remove(num)
		stacklen -= 1
	else:
		stack.add(num)
		stacklen += 1
		maxstack = max(maxstack, stacklen)
print(maxstack)


input()
socks = input().split()
socks_set = set()
max_socks = 0
for sock in socks:
	if sock in socks_set:
		max_socks = max(max_socks, len(socks_set))
		socks_set.remove(sock)
	else:
		socks_set.add(sock)
print(max(len(socks_set), max_socks))


n = int(input())
a = [int(i) for i in input().split()]
m = a[0]
b = []
s = 0
for i in a:
	if i > m:
		m = i
for i in range(m):
	b.append(0)
m = 0
for i in a:
	b[i - 1] = (b[i - 1] + 1) % 2
	if b[i - 1] == 1:
		s += 1
	else:
		s -= 1
	if s > m:
		m = s
print(m)


n = int(input())
A = map(int, input().split())
before = set()
cnt = 0
ans = 0
for x in A:
	if x in before:
		cnt -= 1
	else:
		cnt += 1
		before.add(x)
	ans = max(ans, cnt)
print(ans)


n = input()
s = set()
ans = 0
for i in input().split():
	if i not in s:
		s.add(i)
		ans = max(ans, len(s))
	else:
		s.discard(i)
print(ans)


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


N = int(input())
A = list(map(int, input().split()))
se = set([])
cnt = 0
ans = 0
for a in A:
	if a in se:
		cnt -= 1
		se.remove(a)
	else:
		se.add(a)
		cnt += 1
		ans = max(ans, cnt)
print(ans)


n = int(input())
socks = [int(x) for x in input().split()]
stack = []
res = 0
current = 0
for i in range(n + 1):
	stack.append(0)
for i in range(2 * n):
	if stack[socks[i]] == 0:
		stack[socks[i]] = 1
		current += 1
	elif stack[socks[i]] == 1:
		stack[socks[i]] = 2
		current -= 1
	res = max(res, current)
print(res)


n = int(input())
x = list(map(int, input().split()))
b = {}
c = 0
a = []
for i in range(2 * n):
	if x[i] in b:
		c -= 1
	else:
		c += 1
		b[x[i]] = 1
	a.append(c)
print(max(a))


n = int(input())
m = 0
now = 0
table = [False] * 100100
arr = list(map(int, input().split()))
for i in arr:
	if table[i]:
		now -= 1
	else:
		table[i] = True
		now += 1
	m = max(now, m)
print(m)


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


def solve(n, x):
	maxi = 0
	c = set()
	for i in x:
		if i in c:
			c.remove(i)
		else:
			c.add(i)
			maxi = max(maxi, len(c))
	return maxi

def main():
	n = int(input())
	x = list(map(int, input().split()))
	print(solve(n, x))
main()


input()
a = input().split()
(b, ans, k) = (set(), 0, 0)
for x in a:
	b ^= {x}
	if len(b) > ans:
		ans = len(b)
print(ans)


n = int(input())
line = map(str, input().split())
table = dict()
max_num = 0
for it in line:
	if it in table.keys():
		max_num = max(max_num, len(table.items()))
		table.pop(it)
	else:
		table.setdefault(it)
print(max_num)


def main():
	a = int(input())
	s = list(map(int, input().split()))
	b = 0
	c = []
	e = set()
	for i in range(a * 2):
		if s[i] not in e:
			b += 1
			e.add(s[i])
		else:
			c.append(b)
			b -= 1
		c.append(b)
	f = max(c)
	print(f)
main()


n = int(input())
a = list(map(int, input().split()))
b = [0] * (n + 1)
count = 0
c = 0
for k in range(len(a)):
	n = a[k]
	if b[n] == 1:
		b[n] = 0
		c -= 1
	else:
		b[n] = 1
		c += 1
	if c > count:
		count = c
print(count)


from collections import Counter
l = int(input())
c = Counter()
maximal = 0
for i in input().split():
	c[i] += 1
	if c[i] == 2:
		del c[i]
	maximal = max(maximal, len(c))
print(maximal)


N = input()
L = input().split()
S = set()
m = 0
for i in L:
	S ^= {i}
	if len(S) > m:
		m = len(S)
print(m)


import os
import sys
import math
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def dijkstra(start, distance, path, n):
	visited = [False for _ in range(n)]
	distance[start] = 0
	for i in range(n):
		v = -1
		for j in range(n):
			if not visited[v] and (v == -1 or distance[j] < distance[v]):
				v = j
		if distance[v] == math.inf:
			break
		visited[v] = True
		for edge in adj[v]:
			destination = edge[0]
			weight = edge[1]
			if distance[v] + weight < distance[destination]:
				distance[destination] = distance[v] + weight
				path[destination] = v

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def lcm(a, b):
	return a * b // gcd(a, b)

def ncr(n, r):
	return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def npr(n, r):
	return math.factorial(n) // math.factorial(n - r)

def seive(n):
	primes = [True] * (n + 1)
	ans = []
	for i in range(2, n):
		if not primes[i]:
			continue
		j = 2 * i
		while j <= n:
			primes[j] = False
			j += i
	for p in range(2, n + 1):
		if primes[p]:
			ans += [p]
	return ans

def factors(n):
	factors = []
	x = 1
	while x * x <= n:
		if n % x == 0:
			if n // x == x:
				factors.append(x)
			else:
				factors.append(x)
				factors.append(n // x)
		x += 1
	return factors

def main():
	try:
		n = inp()
		a = inlt()
		d = {}
		c = m = 0
		for i in a:
			if i in d:
				del d[i]
				c -= 1
			else:
				d[i] = 1
				c += 1
			m = max(m, c)
		print(m)
	except Exception as e:
		print(e)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


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())
c = [0 for i in range(n + 1)]
a = list(map(int, input().split()))
(m, t) = (0, 0)
for i in range(0, 2 * n):
	if c[a[i]] == 1:
		t -= 1
	elif c[a[i]] == 0:
		c[a[i]] += 1
		t += 1
	if t > m:
		m = t
print(m)


n = int(input())
l = input().split()
(l1, c) = (set(), 0)
for i in l:
	if i not in l1:
		l1.add(i)
	else:
		l1.discard(i)
	c = max(c, len(l1))
print(c)


n = int(input())
a = list(map(int, input().split()))
b = set()
ans = 0
for i in a:
	if i in b:
		b.discard(i)
	else:
		b.add(i)
	ans = max(ans, len(b))
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
pairtracker = [0 for x in range(n)]
largestsofar = 0
countnow = 0
for x in a:
	x = x - 1
	if pairtracker[x] == 0:
		pairtracker[x] = 1
		countnow += 1
		if countnow > largestsofar:
			largestsofar = countnow
	else:
		countnow -= 1
print(largestsofar)


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


import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
n = mint()
c = [0] * n
x = 0
r = 0
for i in mints():
	c[i - 1] += 1
	if c[i - 1] == 2:
		x -= 1
	else:
		x += 1
	r = max(r, x)
print(r)


n = int(input())
socks = map(int, input().split())
collected_one = [False for i in range(n + 1)]
ans = cnt = 0
for i in socks:
	if not collected_one[i]:
		cnt += 1
		collected_one[i] = True
	else:
		cnt -= 1
	ans = max(ans, cnt)
print(ans)


def maxSocksOnTable(arr):
	maxOnTable = 0
	currentOnTable = 0
	seen = set()
	for num in arr:
		if num in seen:
			currentOnTable -= 1
		else:
			seen.add(num)
			currentOnTable += 1
			if currentOnTable > maxOnTable:
				maxOnTable = currentOnTable
	return maxOnTable
n = int(input())
arr = list(map(int, input().split()))
print(maxSocksOnTable(arr))


n = int(input())
l = list(map(int, input().split()))
a = {}
m = 0
for i in l:
	if i in a:
		del a[i]
	else:
		a[i] = 1
	if len(a) > m:
		m = len(a)
print(m)


from collections import defaultdict
n = int(input())
dic = defaultdict(lambda : 0)
socks = [int(i) for i in input().split()]
table = 0
Max = 0
for i in socks:
	if dic[i] == 1:
		if Max < table:
			Max = table
		table -= 1
	else:
		dic[i] = 1
		table += 1
print(Max)


n = int(input())
l = list(map(int, input().split()))
k = 0
mx = 0
m = [0] * (n + 1)
for i in l:
	if m[i] > 0:
		k -= 1
		m[i] -= 1
	else:
		m[i] += 1
		k += 1
	mx = max(k, mx)
print(mx)


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)


n = int(input())
l = list(map(int, input().split()))
x = [0] * n
m = 0
c = 0
for i in range(2 * n):
	x[l[i] - 1] += 1
	if x[l[i] - 1] == 1:
		c += 1
		if c > m:
			m = c
	else:
		c -= 1
print(m)


n = int(input())
l = list(map(int, input().split()))
p = {}
m = []
for i in l:
	if i not in p:
		p[i] = 1
		m.append(len(p))
	elif i in p:
		del p[i]
		m.append(len(p))
print(max(m))


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


n = int(input())
socks = [int(x) for x in input().split(' ')]
table = set()
m = 0
for sock in socks:
	if sock in table:
		table.remove(sock)
	else:
		table.add(sock)
		m = max(m, len(table))
print(m)


n = int(input())
a = list(map(int, input().split()))
on_table = set()
maxi = 1
for i in a:
	if i not in on_table:
		on_table.add(i)
	else:
		ls = len(on_table)
		if ls > maxi:
			maxi = ls
		on_table.remove(i)
print(maxi)


n = int(input())
arr = list(map(int, input().split()))
flag = [0] * (10 ** 5 + 5)
k = 0
mx = 0
for c in arr:
	if flag[c] == 0:
		k += 1
		flag[c] += 1
		mx = max(mx, k)
	else:
		k -= 1
		flag[c] -= 1
print(mx)


n = int(input())
lst = [int(i) for i in input().split()]
table = 2 * n * [0]
max = 0
len = 0
for i in range(2 * n):
	if table[lst[i] - 1] == 0:
		table[lst[i] - 1] = 1
		len += 1
	else:
		if max < len:
			max = len
		table[lst[i] - 1] = 0
		len -= 1
print(max)


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


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())
a = list(map(int, input().split()))
ans = 0
t = 0
d = {}
for i in range(2 * n):
	if a[i] not in d:
		d[a[i]] = 1
		t += 1
		ans = max(ans, t)
	else:
		d.pop(a[i])
		t -= 1
print(ans)


input()
an = 0
A = list(map(int, input().split()))
v = set()
for a in A:
	if a in v:
		v.remove(a)
	else:
		v.add(a)
		an = max(an, len(v))
print(an)


import sys
n = int(input())
an = list(map(int, sys.stdin.readline().split()))
ans = 0
cur = 0
on_table = set()
for x in an:
	if x in on_table:
		on_table.remove(x)
	else:
		on_table.add(x)
		if len(on_table) > ans:
			ans = len(on_table)
print(ans)


n = int(input())
s = []
f = [0] * n
mx = 0
c = 0
for i in input().split():
	if f[int(i) - 1]:
		c -= 1
	else:
		c += 1
		f[int(i) - 1] = 1
	mx = max(mx, c)
print(mx)