Berland National Library has recently been built in the capital of Berland. In addition, in the library you can take any of the collected works of Berland leaders, the library has a reading room.

Today was the pilot launch of an automated reading room visitors' accounting system! The scanner of the system is installed at the entrance to the reading room. It records the events of the form "reader entered room", "reader left room". Every reader is assigned a registration number during the registration procedure at the library — it's a unique integer from 1 to 10^6. Thus, the system logs events of two forms:  "+ r_{i}" — the reader with registration number r_{i} entered the room;  "- r_{i}" — the reader with registration number r_{i} left the room. 

The first launch of the system was a success, it functioned for some period of time, and, at the time of its launch and at the time of its shutdown, the reading room may already have visitors.

Significant funds of the budget of Berland have been spent on the design and installation of the system. Therefore, some of the citizens of the capital now demand to explain the need for this system and the benefits that its implementation will bring. Now, the developers of the system need to urgently come up with reasons for its existence.

Help the system developers to find the minimum possible capacity of the reading room (in visitors) using the log of the system available to you.


-----Input-----

The first line contains a positive integer n (1 ≤ n ≤ 100) — the number of records in the system log. Next follow n events from the system journal in the order in which the were made. Each event was written on a single line and looks as "+ r_{i}" or "- r_{i}", where r_{i} is an integer from 1 to 10^6, the registration number of the visitor (that is, distinct visitors always have distinct registration numbers).

It is guaranteed that the log is not contradictory, that is, for every visitor the types of any of his two consecutive events are distinct. Before starting the system, and after stopping the room may possibly contain visitors.


-----Output-----

Print a single integer — the minimum possible capacity of the reading room.


-----Examples-----
Input
6
+ 12001
- 12001
- 1
- 1200
+ 1
+ 7

Output
3
Input
2
- 1
- 2

Output
2
Input
2
+ 1
- 1

Output
1


-----Note-----

In the first sample test, the system log will ensure that at some point in the reading room were visitors with registration numbers 1, 1200 and 12001. More people were not in the room at the same time based on the log. Therefore, the answer to the test is 3.

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
import sys

def main():
	n = int(input())
	currently_in = set()
	capacity = 0
	for _ in range(n):
		(event_type, id) = input().split()
		id = int(id)
		if event_type == '+':
			currently_in.add(id)
			if len(currently_in) > capacity:
				capacity = len(currently_in)
		elif id in currently_in:
			currently_in.remove(id)
		else:
			capacity += 1
	print(capacity)
main()


c = [0] * 1000001
n = int(input())
mi = ma = k = 0
for i in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		k += 1
		c[b] = 1
	elif c[b]:
		k -= 1
		c[b] = 0
	else:
		ma += 1
	ma = max(ma, k)
	mi = min(mi, k)
print(ma - mi)


ans = 0
d = set()
n = int(input())
c = 0
was = 0
for i in range(n):
	data = input().split()
	r = int(data[1])
	if data[0] == '+':
		c += 1
		d.add(r)
	elif r in d:
		c -= 1
		d.remove(r)
	else:
		ans += 1
	if c > ans:
		ans = c
print(ans)


n = int(input())
(k, h, a) = (0, 0, list())
for i in range(n):
	(x, y) = map(str, input().split())
	if x == '+' and k:
		k -= 1
		a.append(y)
	elif x == '+' and (not k):
		h += 1
		a.append(y)
	elif x == '-' and y in a:
		k += 1
		a.remove(y)
	elif x == '-' and y not in a:
		h += 1
		k += 1
print(h)


from collections import defaultdict
d = defaultdict(lambda : 0)
cnt = 0
ans = 0
for _ in range(int(input())):
	(x, val) = list(map(str, input().split()))
	val = int(val)
	if x == '+':
		d[val] = 1
		cnt += 1
		ans = max(ans, cnt)
	else:
		if val not in d:
			ans += 1
		else:
			cnt -= 1
		ans = max(ans, cnt)
print(ans)


n = int(input())
minCapacity = 0
capacity = 0
readersIn = []
for i in range(0, n):
	rec = input().split()
	if rec[0] == '+':
		capacity += 1
		readersIn.append(rec[1])
	elif rec[0] == '-':
		if readersIn.__contains__(rec[1]):
			readersIn.remove(rec[1])
			capacity -= 1
		else:
			minCapacity += 1
	if capacity > minCapacity:
		minCapacity = capacity
print(str(minCapacity))


n = int(input())
cache = {}
a = [set() for i in range(n + 1)]
for i in range(n):
	inputs = input().split()
	operation = inputs[0] == '+'
	id = int(inputs[1])
	a[i + 1] = a[i].copy()
	if cache.get(id) == None:
		cache[id] = True if operation else None
	if operation:
		a[i + 1].add(id)
	else:
		if not cache.get(id):
			for j in range(0, i + 2):
				a[j].add(id)
		a[i + 1].remove(id)
mx = 0
for i in a:
	if len(i) > mx:
		mx = len(i)
print(mx)


n = int(input())
visit = set()
minn = 0
for i in range(n):
	s = input()
	n = int(s[2:])
	if s[0] == '-' and n in visit:
		visit.discard(n)
	elif s[0] == '-':
		minn += 1
	else:
		visit.add(n)
		if minn < len(visit):
			minn = len(visit)
print(minn)


n = int(input())
store = []
current = 0
m_units = 0
for r in range(n):
	r = input()
	r = r.strip().split()
	if r[0] == '+':
		store.append(r[1])
		current += 1
		if m_units < len(store):
			m_units == len(store)
	elif r[1] in store:
		store.remove(r[1])
		current -= 1
		if m_units < len(store):
			m_units == len(store)
	else:
		m_units += 1
	m_units = max(m_units, current)
print(m_units)


listn = []
n = 0
entered = set()
previouslyentered = []
for person in range(int(input())):
	x = input().split()
	if x[0] == '+':
		entered.add(int(x[1]))
		n += 1
	else:
		try:
			entered.remove(int(x[1]))
			n -= 1
		except:
			previouslyentered.append(person)
	listn.append(n)
for i in previouslyentered:
	listn = list((k + 1 for k in listn[:i + 1])) + listn[i + 1:]
print(max(listn))


set1 = set()
m = 0
s = ''
for _ in range(int(input())):
	s = input()
	if s[0] == '-':
		if s[1:len(s)] in set1:
			set1.remove(s[1:len(s)])
		else:
			m += 1
	else:
		set1.add(s[1:len(s)])
	m = max(len(set1), m)
print(m)


def func():
	tup = tuple()
	for i in range(n):
		a = input().split()
		b = int(a[1])
		if a[0] == '-':
			b = -b
		tup = tup + (b,)
	return tup
n = int(input())
tup = func()
tup2 = tuple()
for i in range(n):
	el = tup[i]
	if el < 0:
		mod = abs(el)
		if tup[0:i].count(mod) <= 0:
			tup2 = tup2 + (mod,)
tup2 = tup2 + tup
mAx = 0
count = 0
for i in tup2:
	if i > 0:
		count += 1
	else:
		count -= 1
	if count > mAx:
		mAx = count
print(mAx)


n = int(input())
container = set([])
commands = []
before_start = []
for _ in range(n):
	(command, identity) = input().split()
	identity = int(identity)
	commands.append((command, identity))
	if command == '+':
		container.add(identity)
	elif identity in container:
		container.remove(identity)
	else:
		before_start.append(identity)
container = set(before_start)
m = len(container)
for (command, value) in commands:
	if command == '+':
		container.add(value)
	else:
		container.remove(value)
	m = max(len(container), m)
print(m)


import sys

def fi():
	return sys.stdin.readline()
n = int(fi())
d = dict()
c = 0
ans = 0
line = 0
for i in range(n):
	(a, b) = fi().split()
	d.setdefault(b, 0)
	if a == '+':
		d[b] = 1
		c += 1
	elif d[b] == 0:
		ans += 1
	else:
		d[b] = 0
		c -= 1
	ans = max(ans, c)
print(ans)


n = int(input())
knowninside = set()
maxcount = 0
for i in range(n):
	(inout, id) = input().split()
	if inout == '+':
		knowninside.add(id)
		maxcount = max(maxcount, len(knowninside))
	elif id in knowninside:
		knowninside.remove(id)
	else:
		maxcount += 1
print(maxcount)


n = int(input())
nt = [0]
ppl = [0]
for i in range(n):
	(op, num) = list(input().split())
	num = int(num)
	if op == '+':
		nt.append(nt[-1] + 1)
		ppl.append(num)
	if op == '-':
		if num in ppl:
			ppl.pop(ppl.index(num))
		else:
			for i in range(len(nt)):
				nt[i] += 1
		nt.append(nt[-1] - 1)
print(max(nt))


n = int(input())
max_cap = 0
current_cap = 0
current_prev = 0
inside = set()
for _ in range(n):
	(a, i) = input().split()
	if a == '+':
		current_cap += 1
		inside.add(i)
	elif i in inside:
		inside.remove(i)
		current_cap -= 1
	else:
		current_prev += 1
	max_cap = max(max_cap, current_cap - current_prev)
print(max_cap + current_prev)


n = int(input())
matrix = [[i for i in input().split()] for j in range(n)]
array = []
result = 0
state = 0
for i in range(len(matrix)):
	if matrix[i][0] == '+':
		state += 1
	if matrix[i][0] == '-':
		if matrix[i][1] in array:
			state -= 1
		else:
			result += 1
	if matrix[i][1] not in array:
		array.append(matrix[i][1])
	if state > result:
		result = state
print(result)


N = int(input())
room = set()
max_occupancy = 0
for _ in range(N):
	(command, uid) = input().split()
	uid = int(uid)
	if command == '+':
		room.add(uid)
	if command == '-':
		if uid not in room:
			room.add(uid)
			max_occupancy += 1
		room.remove(uid)
	max_occupancy = max(max_occupancy, len(room))
print(max_occupancy)


n = int(input())
r = [input().split() for i in range(n)]
(ss, cs) = (set(), set())
for ri in r:
	if ri[0] == '+':
		cs.add(ri[1])
	elif ri[1] in cs:
		cs.remove(ri[1])
	else:
		ss.add(ri[1])
c = len(ss)
v = c
for ri in r:
	if ri[0] == '+':
		c += 1
		v = max(v, c)
	else:
		c -= 1
print(v)


peoplein = 0
capacity = 0
n = int(input())
data = [0 for i in range(1, 10 ** 6 + 10)]
for i in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		data[b] = 1
		peoplein += 1
		capacity = max(capacity, peoplein)
	elif a == '-':
		if data[b] == 0:
			data[b] = -1
			capacity += 1
		elif data[b] == 1:
			data[b] = -1
			peoplein -= 1
print(capacity)


ins = []
sumi = []
ous = []
n = int(input())
l = []
for i in range(n):
	l.append(str(input()))
	sumi.append(0)
sumi.append(0)
for i in range(n):
	if l[i][0] == '+':
		ins.append(l[i][2:len(l[i])])
		for j in range(i + 1, n + 1):
			sumi[j] += 1
	elif l[i][0] == '-' and l[i][2:len(l[i])] in ins:
		ins.remove(l[i][2:len(l[i])])
		for j in range(i + 1, n + 1):
			sumi[j] -= 1
	else:
		for j in range(0, i + 1):
			sumi[j] += 1
print(max(sumi))


n = int(input())
ppl = set()
res = 0
for _ in range(n):
	i = input()
	if i[0] == '-':
		if i[2:] in ppl:
			ppl.remove(i[2:])
		else:
			res += 1
	else:
		ppl.add(i[2:])
	res = max(len(ppl), res)
print(res)


l = []
for i in range(int(input())):
	l.append(input().split())
a = 10 ** 6 * [False]
ans = 0
cap = 0
for i in range(len(l)):
	if l[i][0] == '-':
		if a[int(l[i][1]) - 1] == False:
			ans += 1
		else:
			cap -= 1
	else:
		a[int(l[i][1]) - 1] = True
		cap += 1
	ans = max(ans, cap)
print(ans)


n = int(input())
col = 0
max = 0
p = []
q = []
e = []
for i in range(n):
	(a, b) = list(input().split())
	b = int(b)
	q.append([a, b])
	if a == '-' and b not in p:
		col += 1
		e.append(b)
	p.append(b)
for i in range(n):
	if col >= max:
		max = col
	if q[i][0] == '+':
		e.append(q[i][1])
		col += 1
	else:
		e.remove(q[i][1])
		col -= 1
	if col >= max:
		max = col
print(max)


n = int(input())
a = {}
k = 0
for i in range(n):
	(c, b) = input().split()
	if c == '+':
		a[b] = 1
	elif b in a:
		del a[b]
	else:
		k += 1
	if k < len(a):
		k = len(a)
print(k)


n = int(input())
a = [0] * 1000001
curr = 0
max_capacity = 0
for i in range(n):
	(op, num) = map(str, input().split())
	num = int(num)
	if op == '+':
		a[num] = 1
		curr += 1
	elif a[num] == 0:
		max_capacity += 1
	else:
		a[num] -= 1
		curr -= 1
	max_capacity = max(max_capacity, curr)
print(max_capacity)


import sys
record_count = int(str(sys.stdin.readline().strip('\n')))
records_list = []
for i in range(record_count):
	str_list = sys.stdin.readline().strip('\n').split(' ')
	record_list = [str(i) for i in str_list]
	records_list.append(record_list)
room = []
total = 0
result = 0
for record in records_list:
	if record[0] == '+' and (not record[1] in room):
		room.append(record[1])
		if len(room) > total:
			total += 1
	if record[0] == '-' and (not record[1] in room):
		total += 1
	if record[0] == '-' and record[1] in room:
		room.remove(record[1])
if len(room) > total:
	result = len(room)
else:
	result = total
print(result)


n = int(input())
win = set()
k = 0
ans = 0
for _ in range(n):
	(pm, i) = input().split()
	if pm == '+':
		win |= {i}
		k += 1
		if k > ans:
			ans = k
	elif i in win:
		k -= 1
	else:
		ans += 1
print(ans)


n = int(input())
events = [input().split() for i in range(n)]
ghosts = set()
inside = set()
for (op, id) in events:
	if op == '-':
		if id not in inside:
			ghosts.add(id)
	else:
		inside.add(id)
inside = ghosts
max_count = len(inside)
for (op, id) in events:
	if op == '-':
		inside.remove(id)
	else:
		inside.add(id)
		max_count = max(max_count, len(inside))
print(max_count)


def arr_inp():
	return [str(x) for x in stdin.readline().split()]
from sys import stdin
from collections import defaultdict
mem = defaultdict(int)
(ans, ans2, last) = (0, 0, 0)
for i in range(int(input())):
	(sign, num) = arr_inp()
	if sign == '-':
		if not mem[num]:
			ans2 += 1
		else:
			mem[num] = 0
			ans -= 1
	else:
		mem[num] = 1
		ans += 1
		if ans > ans2:
			ans2 += 1
print(ans2)


(n, data, ans, data1, req) = (int(input()), set(), 0, set(), [])
for i in range(n):
	(req1, num) = input().split()
	if req1 == '+':
		data.add(int(num))
	elif int(num) in data:
		data.remove(int(num))
	else:
		data1.add(int(num))
	req.append([req1, int(num)])
for i in range(n):
	ans = max(ans, len(list(data1)))
	if req[i][0] == '+':
		data1.add(req[i][1])
	else:
		data1.remove(req[i][1])
	ans = max(ans, len(list(data1)))
print(ans)


n = int(input())
count = 0
are_in = []
c = 0
st = [0]
for i in range(n):
	s = input().split()
	if s[0] == '-':
		count -= 1
		st.append(count)
	if s[0] == '-' and s[1] not in are_in:
		c += 1
	if s[0] == '+':
		are_in.append(s[1])
		count += 1
		st.append(count)
print(max(st) + c)


n = int(input())
l = [0] * (10 ** 6 + 1)
capacity = 0
cur = 0
for i in range(n):
	s = input().split()
	visitor = int(s[1])
	if s[0] == '+':
		l[visitor] = 1
		cur += 1
		if cur > capacity:
			capacity = cur
	elif l[visitor] == 0:
		capacity += 1
	else:
		l[visitor] = 0
		cur -= 1
print(capacity)


import sys
count = 0

def func(s_list):
	dic = {}
	room_set = set()
	room_num = 0
	max = 0
	for tmp in s_list:
		s1 = tmp.strip().split(' ')[0]
		s2 = tmp.strip().split(' ')[1]
		if s1 == '-':
			dic[s2] = dic.get(s2, 0) - 1
			if dic[s2] < 0:
				room_set.add(s2)
		else:
			dic[s2] = dic.get(s2, 0) + 1
	for (k, v) in dic.items():
		if v < 0:
			room_set.add(k)
	room_num = len(room_set)
	max = room_num
	for tmp in s_list:
		s1 = tmp.strip().split(' ')[0]
		s2 = tmp.strip().split(' ')[1]
		if s1 == '-':
			room_num -= 1
		else:
			room_num += 1
		if room_num > max:
			max = room_num
	return max
s_list = []
for line in sys.stdin:
	if count == 0:
		num_tmp = int(line.strip())
		count += 1
		continue
	s_list.append(line.strip())
print(func(s_list))


a = int(input())
x = []
y = []
mx = 0
for i in range(a):
	aw = input().split()
	x.append(aw[0])
	y.append(aw[1])
people = set()
for i in range(a):
	if x[i] == '-':
		if y[i] in people:
			people.remove(y[i])
		else:
			mx += 1
	elif x[i] == '+':
		people.add(y[i])
	mx = max(mx, len(people))
print(mx)


n = int(input())
room = set()
maximum = 0
for _ in range(n):
	(t, r) = input().split()
	r = int(r)
	if t == '+':
		room.add(r)
		maximum = max(maximum, len(room))
	elif r in room:
		room.remove(r)
	else:
		maximum += 1
print(maximum)


def main():
	n = int(input())
	initial_population = 0
	maximum_population = 0
	current_population = 0
	population_snapshots = [0] * (n + 1)
	population_set = set()

	def increase(index):
		if index > 0:
			population_snapshots[index] = population_snapshots[index - 1] + 1
		else:
			population_snapshots[index] = 1

	def copy(index):
		if index > 0:
			population_snapshots[index] = population_snapshots[index - 1]
		else:
			population_snapshots[index] = 0

	def decrease(index):
		population_snapshots[index] = population_snapshots[index - 1] - 1

	def increment_upto(end):
		for i in range(end + 1):
			population_snapshots[i] += 1
	for index in range(1, n + 1):
		(direction, receipt) = input().split()
		if direction == '+':
			increase(index)
			current_population += 1
			population_set.add(receipt)
		elif receipt in population_set:
			decrease(index)
			current_population -= 1
			population_set.remove(receipt)
		else:
			copy(index)
			increment_upto(index - 1)
			initial_population += 1
		maximum_population = max(maximum_population, current_population)
	print(max(population_snapshots))

def __starting_point():
	main()
__starting_point()


from sys import stdin, stdout
from os import path
rd = lambda : stdin.readline().strip()
wr = stdout.write
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
import time, math
x = int(rd())
capacity = 0
roomCount = 0
amr = dict()
mx = -1
prev = -1
for _ in range(x):
	(sign, id) = map(str, rd().split())
	if sign == '+':
		roomCount += 1
		capacity = max(capacity, roomCount)
	elif id in amr:
		roomCount -= 1
	else:
		capacity += 1
	amr[id] = 1
print(capacity)


n = int(input())
ma = 0
now = 0
inside = []
for i in range(0, n):
	(a, b) = input().split()
	temp = int(b)
	if a == '+':
		now = now + 1
		inside.append(temp)
		if ma < now:
			ma = now
	elif temp in inside:
		now = now - 1
		inside.remove(temp)
	else:
		ma = ma + 1
print(ma)


n = int(input())
city = [list(map(str, input().split())) for i in range(n)]
numbers = [0] * 1000000
maximum = 0
for i in range(n):
	if city[i][0] == '+':
		numbers[int(city[i][1]) - 1] = 1
	else:
		if numbers[int(city[i][1]) - 1] == 0:
			maximum += 1
		numbers[int(city[i][1]) - 1] = 0
numbers = [0] * 1000000
maxi = maximum
for i in range(n):
	if city[i][0] == '+':
		maximum += 1
	else:
		maximum -= 1
	maxi = max(maxi, maximum)
print(maxi)


import sys
input = lambda : sys.stdin.readline()
int_arr = lambda : list(map(int, input().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().split())
get_int = lambda : map(int, input().split())
get_flo = lambda : map(float, input().split())
mod = 1000000007

def solve():
	pass
In = set()
(curr, ans) = (0, 0)
for _ in range(int(input())):
	(s, n) = get_str()
	if s == '+':
		curr += 1
		In.add(n)
		ans = max(curr, ans)
	elif s == '-':
		if n not in In:
			ans += 1
		else:
			curr -= 1
			In.remove(n)
print(max(curr, ans))


(n, l, m, a) = (int(input()), [0] * 1000000, 0, [])
for _ in range(n):
	a.append(input())
for i in range(n):
	v = int(a[i][2:])
	if a[i][0] == '+':
		l[v - 1] = 1
	elif not l[v - 1]:
		m += 1
ans = m
for i in range(n):
	if a[i][0] == '+':
		m += 1
		ans = max(m, ans)
	else:
		m -= 1
print(ans)


n = int(input())
l_p = list()
s_e = set()
p_e = 0
for _ in range(n):
	l_t = input().split()
	l_p.append(l_t)
	if int(l_t[0] == '-' and int(l_t[1]) in s_e):
		p_e -= 1
		s_e.remove(int(l_t[1]))
	elif l_t[0] == '+':
		p_e += 1
		s_e.add(int(l_t[1]))
c_p = p_e
m_p = c_p
for l_t in l_p[::-1]:
	if l_t[0] == '-':
		c_p += 1
	else:
		c_p -= 1
	m_p = max(m_p, c_p)
print(m_p)


in_persons = 0
total_cap = 0
entered = []
for i in range(int(input())):
	entry = input()
	if entry[0] == '+':
		in_persons += 1
		entered.append(int(entry[2:]))
	elif entry[0] == '-':
		if int(entry[2:]) not in entered:
			total_cap += 1
		else:
			in_persons -= 1
	total_cap = max(total_cap, in_persons)
print(total_cap)


def main():
	n = int(input())
	result = 0
	d = set()
	for i in range(n):
		(t, a) = input().split()
		a = int(a)
		if t == '+':
			d.add(a)
			result = max(result, len(d))
		elif a in d:
			d.remove(a)
		else:
			result += 1
	print(result)
main()


def solve(events):
	inside = set()
	already_inside = set()
	for (e, r) in events:
		if e == '-':
			if r not in inside:
				already_inside.add(r)
			else:
				inside.remove(r)
		elif e == '+':
			inside.add(r)
	inside = already_inside
	cnt = len(inside)
	for (e, r) in events:
		if e == '-':
			inside.remove(r)
		elif e == '+':
			inside.add(r)
		cnt = max(cnt, len(inside))
	return cnt
n = int(input())
events = [tuple(input().split()) for _ in range(n)]
print(solve(events))


n = int(input())
ori = []
for i in range(n):
	ori.append(input())
max = 0

def cal(ll, s):
	mtemp = []
	ptemp = []
	for i in ll:
		if i[0] == '+':
			ptemp.append(i[1:])
		if i[0] == '-' and i[1:] not in ptemp:
			mtemp.append(i[1:])
	if s in mtemp:
		return len(mtemp) - 1
	else:
		return len(mtemp)
cur = cal(ori, '')
max = cur
for i in range(len(ori)):
	if ori[i][0] == '-':
		cur = cur - 1
	else:
		cur = cur + 1
	if cur > max:
		max = cur
print(max)


n = int(input())
s = set()
now = set()
m = 0
for i in range(n):
	a = input().split()
	if a[0] == '+':
		now.add(a[1])
		s.add(a[1])
		if len(now) > m:
			m = len(now)
	elif a[1] not in s:
		m = max(m, len(now)) + 1
		s.add(a[1])
	else:
		now.discard(a[1])
print(m)


count = 0
ans = 0
a = set()
n = int(input())
for i in range(n):
	reg = input().split()
	reg[1] = int(reg[1])
	if reg[0] == '+':
		a.add(reg[1])
		count += 1
	elif reg[1] in a:
		a.remove(reg[1])
		count -= 1
	else:
		ans += 1
	if count > ans:
		ans = count
print(ans)


n = int(input())
s = set()
inRoom = 0
count = 0
for _ in range(n):
	y = input()
	if y[0] == '+':
		inRoom += 1
		if inRoom > count:
			count += 1
		s.add(y[2:])
	elif y[2:] not in s:
		count += 1
	else:
		s.remove(y[2:])
		inRoom -= 1
print(count)


n = int(input())
ans = 0
k = 0
d = {}
for i in range(n):
	s = input()
	a = int(s[2:])
	if s[0] == '+':
		d[a] = 'yes'
		k += 1
		if k > ans:
			ans = k
	elif a not in d:
		ans += 1
	else:
		d[a] = 'no'
		k -= 1
print(ans)


n = int(input())
s = set()
ans = 0
crtVisNb = 0
for _ in range(n):
	(a, b) = input().split()
	if a == '-':
		if b in s:
			s.remove(b)
			ans = max(ans, crtVisNb)
			crtVisNb -= 1
		else:
			ans += 1
	else:
		s.add(b)
		crtVisNb += 1
		ans = max(ans, crtVisNb)
print(ans)


n = int(input())
mp = dict()
(ans, cur) = (0, 0)
for i in range(n):
	(c, x) = [_ for _ in input().split()]
	x = int(x)
	if c == '-':
		if mp.get(x) == True:
			cur -= 1
			mp[x] = False
		elif mp.get(x) is None:
			ans += 1
			mp[x] = False
	elif c == '+':
		cur += 1
		mp[x] = True
	ans = max(ans, cur)
print(ans)


n = int(input())
res = 0
cur = 0
maxcur = 0
ss = set()
for i in range(n):
	inp = input().split()
	(way, who) = (inp[0], int(inp[1]))
	if way == '+':
		ss.add(who)
		cur += 1
	elif who in ss:
		ss.remove(who)
		cur -= 1
	else:
		res += 1
	if cur > res:
		res = cur
print(res)


n = int(input())
count = [0] * 1000001
cur = 0
ans = 0
for i in range(n):
	(c, d) = input().split()
	d = int(d)
	if c == '-' and count[d]:
		cur -= 1
		count[d] -= 1
	elif c == '-' and (not count[d]):
		ans = ans + 1
	elif c == '+':
		cur += 1
		ans = max(ans, cur)
		count[d] += 1
print(ans)


N = int(input())
cmds = []
ids = []
for i in range(N):
	(cmd, num) = input().split()
	num = int(num)
	cmds.append(cmd)
	ids.append(num)
tmp_set = set([])
first_ids = []
for i in range(N):
	if cmds[i] == '+':
		tmp_set.add(ids[i])
	elif ids[i] in tmp_set:
		tmp_set.remove(ids[i])
	else:
		first_ids.append(ids[i])
se = set(first_ids)
ans = len(se)
for i in range(N):
	if cmds[i] == '+':
		se.add(ids[i])
		ans = max(ans, len(se))
	else:
		se.remove(ids[i])
print(ans)


n = int(input())
arr = []
for i in range(n):
	r = input()
	if '+' in r:
		arr.append(int(r[2:]))
	else:
		arr.append(-int(r[2:]))
k = [0] * n
for i in range(n):
	if arr[i] > 0:
		for j in range(i, n):
			k[j] += 1
	elif -arr[i] in arr[0:i]:
		for j in range(i, n):
			k[j] -= 1
	else:
		for j in range(0, i + 1):
			k[j] += 1
print(max(k))


n = int(input())
mas = set()
submas = set()
ma = 0
l = list()
for i in range(n):
	sob = input().split(' ')
	l.append(sob)
	if sob[0] == '+':
		mas.add(sob[1])
	if sob[0] == '-':
		if sob[1] in mas:
			mas.remove(sob[1])
		else:
			submas.add(sob[1])
ma = max(len(submas), ma)
for i in l:
	if i[0] == '+':
		submas.add(i[1])
		ma = max(len(submas), ma)
	if i[0] == '-':
		submas.remove(i[1])
print(ma)


first = int(input())
joins = list()
cap_max = 0
cap_now = len(joins)
for i in range(0, first):
	people = input().split()
	if people[0] == '+':
		if cap_max == cap_now:
			cap_max += 1
		joins.append(people[1])
	elif people[0] == '-':
		if people[1] not in joins:
			cap_max += 1
		elif people[1] in joins:
			j = joins.index(people[1])
			joins.pop(j)
	cap_now = len(joins)
print(cap_max)


n = int(input())
visitors = set()
max_size = 0
for i in range(n):
	(action, id) = input().split()
	id = int(id)
	if action == '-':
		if id in visitors:
			visitors.remove(id)
		else:
			max_size += 1
	else:
		visitors.add(id)
		max_size = max(max_size, len(visitors))
print(max_size)


n = int(input())
s = set()
m = 0
cur = 0
for i in range(n):
	str = input()
	cmnd = str.split()[0]
	sid = str.split()[1]
	if cmnd == '+':
		s.add(sid)
		cur = cur + 1
	elif cmnd == '-':
		if sid in s:
			s.remove(sid)
			cur = cur - 1
		else:
			m = m + 1
	m = max(m, cur)
print(m)


total = int(input())
s = set()
m = 0
for i in range(total):
	line = input()
	n = int(line[2:])
	flag = line[:1]
	if flag == '+':
		s.add(n)
		m = max(m, len(s))
		continue
	if n in s:
		s.remove(n)
	else:
		m += 1
print(m)


c = 0
n = int(input())
maxx = 0
f = []
curren = {}
special = []
for i in range(n):
	x = input().split()
	if x[0] == '+':
		f.append(x[1])
		c += 1
	elif x[1] in f:
		c -= 1
		f.remove(x[1])
	else:
		special.append(i)
	curren[i] = c
count = len(special)
i = 0
j = 0
while i < n and j < len(special):
	while i <= special[j]:
		curren[i] += count
		i += 1
	count -= 1
	j += 1
maxx = max(curren.values())
print(maxx)


n = int(input())
d = {}
nn = 0
count = 0
m = 0
for i in range(n):
	line = input().split()
	if int(line[1]) in d:
		if line[0] == '-':
			if len(d[int(line[1])]) == 1:
				del d[int(line[1])]
		else:
			d[int(line[1])] += '+'
	else:
		d[int(line[1])] = line[0]
	if line[0] == '+':
		count += 1
	else:
		count -= 1
	if m < count:
		m = count
for (k, v) in d.items():
	if v[0] == '-':
		nn += 1
print(nn + m)


ins = []
out = []
st = 0
empty = 0
n = int(input())
while n:
	x = input()
	y = x.split()
	no = int(y[1])
	y = y[0]
	if y == '-':
		out.append(no)
		if no in ins:
			ins.remove(no)
			empty += 1
		else:
			st += 1
			empty += 1
	else:
		ins.append(no)
		if empty == 0:
			st += 1
		else:
			empty -= 1
	n -= 1
print(st)


n = int(input())
li = []
ma = []
for i in range(n):
	r = input()
	li.append(r)
for i in range(n):
	c = 0
	if li[i][0] == '+':
		c = c + 1
	else:
		temp = li[i]
		temp = '+' + temp[1:]
		if temp not in li[0:i]:
			c = c + 1
	for j in range(0, i):
		if li[j][0] == '+':
			temp = li[j]
			temp = '-' + temp[1:]
			if temp not in li[j + 1:i]:
				c = c + 1
	for k in range(i + 1, n):
		if li[k][0] == '-':
			temp = li[k]
			temp = '+' + temp[1:]
			if temp not in li[0:k]:
				c = c + 1
	ma.append(c)
print(max(ma))


n = int(input())
mn = mx = cur = 0
s = set()
for i in range(n):
	cmd = input()
	if cmd[0] == '+':
		s.add(int(cmd[2:]))
		cur += 1
		mx = max(mx, cur)
	else:
		cur -= 1
		try:
			s.remove(int(cmd[2:]))
		except KeyError:
			mn -= 1
print(mx - mn)


from sys import *
from math import ceil
input = lambda : stdin.readline()
int_arr = lambda : list(map(int, stdin.readline().strip().split()))
str_arr = lambda : list(map(str, stdin.readline().split()))
get_str = lambda : map(str, stdin.readline().strip().split())
get_int = lambda : map(int, stdin.readline().strip().split())
get_float = lambda : map(float, stdin.readline().strip().split())
mod = 1000000007
setrecursionlimit(1000)
dic = {}
tot = 0
mx = 0
prev = tot
for _ in range(int(input())):
	st = str_arr()
	(cond, reg) = (st[0], int(st[1]))
	if cond == '+':
		tot += 1
		mx = max(mx, tot)
		dic[reg] = 1
	elif reg not in dic or dic[reg] == 0:
		mx += 1
	else:
		dic[reg] = 0
		tot -= 1
print(max(mx, tot))


ans = 0
l = []
tmp = 0
for i in range(int(input())):
	d = input().split()
	if d[0] == '+':
		tmp += 1
		l.append(d[1])
	elif d[1] in l:
		del l[l.index(d[1])]
		tmp -= 1
	else:
		ans += 1
	ans = max(tmp, ans)
print(ans)


__author__ = 'user'
n = int(input())
s = set()
ans = 0
x = set()
a = ['0'] * n
b = [0] * n
for i in range(n):
	(type, id) = map(str, input().split())
	(a[i], b[i]) = (type, id)
	id = int(id)
	if type == '+':
		s.add(id)
	elif type == '-':
		if id in s:
			s.remove(id)
		elif id not in s:
			x.add(id)
s.clear()
s = set(x)
ans = max(ans, len(s))
for i in range(n):
	(type, id) = (a[i], b[i])
	id = int(id)
	if type == '+':
		s.add(id)
	elif type == '-':
		if id in s:
			s.remove(id)
	ans = max(ans, len(s))
print(ans)


a = int(input())
b = [0 for i in range(1000001)]
q = 0
cnt = 0
mx = 0
for i in range(a):
	(z, x) = input().split()
	x = int(x)
	if z == '+':
		b[x] = 1
		cnt += 1
	if z == '-':
		if b[x] == 0:
			mx = mx + 1
			cnt += 1
		b[x] = 0
		cnt -= 1
	mx = max(mx, cnt)
print(mx)


a = int(input())
gh = [0] * (int(1000000.0) + 1)
z = [input().split() for _ in ' ' * a]
(i, k, s) = (0, 0, 0)
ok = 0
while i < a:
	if z[i][0] == '+':
		gh[int(z[i][1])] = 1
		s = max(s, sum(gh))
		i += 1
	else:
		while i < a and z[i][0] == '-':
			if gh[int(z[i][1])]:
				gh[int(z[i][1])] = 0
				k += 1
			else:
				ok += 1
			i += 1
		s = max(s, k + sum(gh)) + ok
		k = 0
		ok = 0
print(s)


import os
from math import *
t = int(input())
ans = 0
count = 0
arr = []
while t:
	if count > ans:
		ans = count
	t -= 1
	s = input()
	if s[0] == '+':
		count += 1
		arr.append(s[2:])
	elif s[2:] in arr:
		count -= 1
	else:
		ans += 1
print(max(ans, count))


n = int(input())
max_count = 0
lib = []
for i in range(0, n):
	(sign, key) = input().split()
	if sign == '+':
		lib.append(key)
		if len(lib) > max_count:
			max_count = len(lib)
	elif lib.count(key) > 0:
		lib.remove(key)
	else:
		max_count += 1
print(max_count)


n = int(input())
cmax = 0
curr = 0
records = set()
for i in range(n):
	line = input()
	r = int(line[2:])
	if line[0] == '+':
		curr += 1
		cmax = max(curr, cmax)
		records.add(r)
	elif r in records:
		curr -= 1
		records.remove(r)
	else:
		cmax += 1
print(cmax)


enum = int(input())
before = set()
cur = set()
events = [input().split() for i in range(enum)]
for i in range(enum):
	events[i][1] = int(events[i][1])
for i in range(enum):
	if events[i][0] == '-':
		if events[i][1] not in cur:
			before.add(events[i][1])
			cur.add(events[i][1])
		cur.remove(events[i][1])
	else:
		cur.add(events[i][1])
cur = before
max_l = len(cur)
for i in range(enum):
	if events[i][0] == '-':
		cur.remove(events[i][1])
	else:
		cur.add(events[i][1])
	max_l = max(max_l, len(cur))
print(max_l)


n = int(input())
a = set()
ans = 0
for _ in range(n):
	(sign, num) = input().split()
	if sign == '+':
		a.add(num)
	elif num in a:
		a.remove(num)
	else:
		ans += 1
	ans = max(ans, len(a))
print(ans)


a = int(input())
k = 0
m = 0
l = []
for i in range(a):
	(b, c) = map(str, input().split())
	c = int(c)
	if b == '+':
		l.append(c)
		if m <= 0:
			k += 1
		else:
			m -= 1
	elif b == '-':
		if l.count(c) == 0:
			k += 1
		else:
			l.remove(c)
		m += 1
print(k)


n = int(input())
cur = cap = 0
s = set()
for i in range(n):
	(m, n) = input().split(' ')
	if m == '+':
		cur += 1
		s.add(n)
		if cap < cur:
			cap = cur
	elif n in s:
		cur -= 1
		s.remove(n)
	else:
		cap += 1
print(cap)


def __starting_point():
	n = int(input())
	visitors = set()
	basevisitors = set()
	log = []
	for _ in range(n):
		(sign, ID) = input().split()
		log.append((sign, ID))
		if sign == '+':
			visitors.add(ID)
		elif ID in visitors:
			visitors.remove(ID)
		else:
			basevisitors.add(ID)
	res = len(basevisitors)
	for aLog in log:
		if aLog[0] == '+':
			basevisitors.add(aLog[1])
			res = max(res, len(basevisitors))
		else:
			basevisitors.remove(aLog[1])
	print(res)
__starting_point()


n = int(input())
s = set()
res = 0
for i in range(n):
	r = int(input().replace(' ', ''))
	if r > 0:
		s.add(r)
	elif -r in s:
		s.remove(-r)
	else:
		res += 1
	res = max(res, len(s))
print(res)


n = int(input())
a = [['+', 0] for i in range(n)]
s = set()
countalreadythere = 0
for i in range(n):
	info = input().split()
	a[i][0] = info[0]
	a[i][1] = int(info[1])
	if info[0] == '-' and (not info[1] in s):
		countalreadythere += 1
	elif info[0] == '-':
		s.remove(info[1])
	else:
		s.add(info[1])
s = set()
currentcap = countalreadythere
maxcap = countalreadythere
for i in range(n):
	sign = a[i][0]
	val = a[i][1]
	if sign == '-':
		if val in s:
			s.remove(val)
			currentcap -= 1
		else:
			currentcap -= 1
	elif sign == '+':
		s.add(val)
		currentcap += 1
		if currentcap > maxcap:
			maxcap = currentcap
print(maxcap)


def main():
	d = defaultdict(int)
	n = lai()
	s = [input().split() for i in range(n)]
	(cnt, ans) = (0, 0)
	for x in s:
		if x[0] == '+':
			d[x[1]] += 1
		else:
			d[x[1]] -= 1
		if d[x[1]] == -1:
			d[x[1]] = 0
			cnt += 1
	ans = cnt
	for x in s:
		if x[0] == '+':
			cnt += 1
			ans = max(ans, cnt)
		else:
			cnt -= 1
	print(ans)
from sys import *
import inspect
import re
from math import *
import threading
from collections import *
from pprint import pprint as pp
mod = 998244353
MAX = 10 ** 15

def lai():
	return int(input())

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

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

def deb(p):
	for line in inspect.getframeinfo(inspect.currentframe().f_back)[3]:
		m = re.search('\\bdeb\\s*\\(\\s*([A-Za-z_][A-Za-z0-9_]*)\\s*\\)', line)
		print('%s %d' % (m.group(1), p))

def vector(size, val=0):
	vec = [val for i in range(size)]
	return vec

def matrix(rowNum, colNum, val=0):
	mat = []
	for i in range(rowNum):
		collumn = [val for j in range(colNum)]
		mat.append(collumn)
	return mat

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
main()


n = int(input())
lib = set()
capacity = 0
astate = 0
for i in range(n):
	(st, vis) = input().split()
	if st == '+':
		if vis not in lib:
			astate += 1
			lib.add(vis)
	elif vis not in lib:
		capacity += 1
	else:
		astate -= 1
		lib.remove(vis)
	if astate > capacity:
		capacity = astate
print(capacity)


n = int(input())
records = [input().split() for i in range(n)]
room = set()
pre_room = set()
for record in records:
	if record[0] == '+':
		pre_room.add(record[1])
	elif record[0] == '-':
		if record[1] in pre_room:
			pre_room.remove(record[1])
		else:
			room.add(record[1])
maxi = len(room)
for record in records:
	if record[0] == '+':
		room.add(record[1])
	elif record[0] == '-':
		room.remove(record[1])
	maxi = max(maxi, len(room))
print(maxi)


n = int(input())
sign = []
value = []
count = 0
l = []
for i in range(n):
	(a, b) = map(str, input().split())
	sign.append(a)
	value.append(int(b))
if sign[0] == '-':
	count += 1
for i in range(1, n):
	if sign[i] == '-':
		c = 1
		for j in range(i):
			if value[j] == value[i]:
				c = 0
				break
		if c:
			count += 1
l.append(count)
for i in range(n):
	if sign[i] == '+':
		count += 1
	else:
		count -= 1
	l.append(count)
print(max(l))


n = int(input())
now = 0
max = 0
readers = []
for i in range(n):
	(flag, N) = (i for i in input().split())
	if flag == '+':
		now += 1
		if now > max:
			max = now
	elif N not in readers:
		max += 1
	else:
		now -= 1
	if N not in readers:
		readers.append(N)
print(max)


def main():
	n = int(input())
	prev = set()
	min_cap = 0
	cap = 0
	for _ in range(n):
		cur = input().split()
		is_in = cur[0] == '+'
		idx = int(cur[1])
		if is_in:
			cap += 1
			prev.add(idx)
			min_cap = max(cap, min_cap)
		elif idx not in prev:
			min_cap += 1
			prev.add(idx)
		else:
			cap -= 1
	print(min_cap)
main()


N = int(input())
number = 0
maxnum = 0
visitors = dict()
for n in range(N):
	(inout, ID) = input().split()
	if inout == '+':
		visitors[ID] = 1
		number += 1
	else:
		if ID not in visitors:
			maxnum += 1
		else:
			number -= 1
		visitors[ID] = 0
	if number > maxnum:
		maxnum = number
print(maxnum)


n = int(input())
room = set()
cap = 0
for i in range(n):
	(typ, r) = input().split()
	if typ == '+':
		room.add(r)
	elif r in room:
		room.remove(r)
	else:
		cap += 1
	cap = max(cap, len(room))
print(cap)


def main():
	l = list((tuple(input().split()) for _ in range(int(input()))))
	(a, b) = (set(), set())
	for (sign, name) in l:
		if sign == '+':
			a.add(name)
		elif name in a:
			a.remove(name)
		else:
			b.add(name)
	res = [len(b)]
	for (sign, name) in l:
		if sign == '+':
			b.add(name)
			res.append(len(b))
		else:
			b.remove(name)
	print(max(res))
main()


n = int(input())
arr = {}
ans = 0
cur = 0
for i in range(n):
	(ch, id) = input().split(' ')
	if ch == '+':
		cur += 1
		arr[id] = 1
		if cur > ans:
			ans = cur
	elif not id in arr.keys():
		ans += 1
		arr[id] = 0
	else:
		arr[id] = 0
		cur -= 1
print(ans)


n = int(input())
res = 0
nowin = []
for i in range(n):
	(op, name) = input().split()
	if op == '+':
		nowin.append(name)
		res = max(res, len(nowin))
	elif name not in nowin:
		res += 1
	else:
		nowin.remove(name)
print(res)


n = int(input())
a = [0] * (n + 1)
b = [[0, 0]] * (n + 1)
for i in range(1, n + 1):
	s = list(map(str, input().split()))
	b[i] = s
	if s[0] == '+':
		a[i] = a[i - 1] + 1
	else:
		j = i
		c1 = 0
		while j >= 0:
			if b[j][0] == '+' and b[j][1] == b[i][1]:
				c1 = -1
				break
			j = j - 1
		if c1 != -1:
			for j in range(0, i + 1):
				a[j] = a[j] + 1
		if a[i - 1] == 0:
			a[i] = 0
		else:
			a[i] = a[i - 1] - 1
print(max(a))


from collections import defaultdict
num_logs = int(input())
room_cap = 0
in_room = 0
code_dict = defaultdict(int)
for i in range(num_logs):
	(info, code) = input().split()
	if info == '+' and in_room == room_cap:
		room_cap += 1
		in_room += 1
		code_dict[code] = 1
	elif info == '+' and in_room < room_cap:
		code_dict[code] = 1
		in_room += 1
	elif info == '-':
		if code_dict[code] == 1:
			in_room -= 1
		else:
			room_cap += 1
print(room_cap)


d = set()
m = 0
for _ in range(int(input())):
	(x, i) = input().split()
	if x == '-':
		if i in d:
			d.remove(i)
		else:
			m += 1
	else:
		d.add(i)
	m = max(m, len(d))
print(m)


n = int(input())
l1 = []
k = 0
M = [list(map(str, input().split())) for i in range(n)]
ma = 0
p = 0
for i in range(n):
	if M[i][0] == '+':
		p = p + 1
		k = 0
		l1.append(M[i][1])
	if M[i][0] == '-':
		if M[i][1] not in l1:
			ma = ma + 1
		else:
			p = p - 1
			for j in range(len(l1)):
				if M[i][1] == l1[j]:
					l1[j] = 0
	ma = max(ma, p)
print(ma)


reader = []
listOfActions = int(input())
caseOf = 0
readerGone = 0
while True:
	action = input().split(' ')
	actionPoM = action[0]
	actionNum = action[1]
	if actionPoM == '+':
		try:
			if reader.index(action[1]) == None:
				reader.append(action[1])
				if readerGone == 0:
					caseOf += 1
				else:
					readerGone -= 1
			elif readerGone == 0:
				caseOf += 1
			else:
				readerGone -= 1
		except:
			reader.append(action[1])
			if readerGone == 0:
				caseOf += 1
			else:
				readerGone -= 1
	elif actionPoM == '-':
		try:
			if reader.index(action[1]) == None:
				reader.append(action[1])
				caseOf += 1
			else:
				readerGone += 1
		except:
			reader.append(action[1])
			caseOf += 1
			readerGone += 1
	listOfActions = listOfActions - 1
	if listOfActions == 0:
		break
print(caseOf)


n = int(input())
ans = 0
l = 0 + 1
h = 200
arr = []
for i in range(n):
	arr.append(list(map(str, input().strip().split())))
dic = {}
em = 0
for i in range(n):
	if arr[i][0] == '+':
		dic[arr[i][1]] = 1
		if em == 0:
			ans += 1
		else:
			em -= 1
	else:
		if arr[i][1] in dic:
			del dic[arr[i][1]]
		else:
			ans += 1
		em += 1
print(ans)


n = int(input())
a = []
abc = n * [0]
for i in range(n):
	x = list(map(str, input().split()))
	a.append(x)
for j in range(n):
	if a[j][0] == '+':
		for k in range(j, n):
			abc[k] += 1
	elif a[j][0] == '-' and ['+', a[j][1]] not in a[:j]:
		for k in range(j + 1):
			abc[k] += 1
	elif a[j][0] == '-' and ['+', a[j][1]] in a[:j]:
		for k in range(j, n):
			abc[k] -= 1
print(max(abc))


In = set()
Out = set()
ans = 0
for (t, r) in [input().split() for i in range(int(input()))]:
	if t == '+':
		In.add(r)
	else:
		ans = max(ans, len(In))
		if r in In:
			In.remove(r)
		else:
			ans += 1
ans = max(ans, len(In))
print(ans)


n = int(input())
(v, passed) = (set(), set())
log = [input().split() for _ in range(n)]
for (op, regno) in log:
	if op == '-' and regno not in passed:
		v.add(regno)
	passed.add(regno)
ops = {'+': v.add, '-': v.remove}
max_in = len(v)
for (op, regno) in log:
	ops[op](regno)
	max_in = max(max_in, len(v))
print(max_in)


n = int(input())
maxnum = 0
current = 0
dic = {}
for i in range(n):
	name = eval(input())
	if name > 0:
		if current < maxnum:
			current = current + 1
			dic[name] = 1
		else:
			maxnum = maxnum + 1
			current = current + 1
			dic[name] = 1
	elif name * -1 in dic:
		current = current - 1
		dic.pop(name * -1)
	else:
		maxnum = maxnum + 1
print(maxnum)


n = int(input())
has = []
ans = 0
for i in range(n):
	(c, x) = input().split()
	if c == '+':
		has.append(x)
	elif x in has:
		has.remove(x)
	else:
		ans += 1
	ans = max(ans, len(has))
print(ans)


n = int(input())
mas = [0] * n
dict = {}
for i in range(n):
	(sign, r) = input().split()
	r = int(r)
	if i == 0:
		isMinus = sign == '-'
	if sign == '+':
		dict[r] = i
	else:
		start = dict.get(r, 0)
		for j in range(start, i):
			mas[j] += 1
		dict.pop(r, None)
for i in dict.values():
	for j in range(i, n):
		mas[j] += 1
max = -1
mini = -1
for i in range(n):
	if mas[i] > max:
		max = mas[i]
		mini = i
if mini == 0 and isMinus:
	max += 1
print(max)


n = int(input())
st = set()
ans = 0
for i in range(n):
	s = list(input().split())
	d = int(s[1])
	if s[0] == '+':
		st.add(d)
		ans = max(ans, len(st))
	elif d not in st:
		ans += 1
	else:
		st.remove(d)
print(ans)


n = int(input())
input_ = []
hash = [0] * int(1000000.0 + 1)
for i in range(n):
	temp = input().split()
	a = int(temp[1])
	if temp[0] == '-':
		a = -a
	input_.append(a)
array = []
for i in input_:
	if i > 0:
		array.append(i)
		hash[i] = 1
	elif hash[-i] == 1:
		array.append(i)
	else:
		array.insert(0, -i)
		array.append(i)
start = end = 0
ans = 0
current_max = 0
while end < len(array):
	value = 1 if array[end] > 0 else -1
	current_max += value
	if current_max < 0:
		start = end = end + 1
		continue
	if ans < current_max:
		ans = current_max
	end += 1
print(ans)


n = int(input())
rj = [int(input().replace(' ', '')) for i in range(n)]
rint = []
rsort = []
nemax = 0
n = 0
nint = 0
nmin = 0
ntot = 0
for e in rj:
	ntot = max(ntot, nint + n)
	if e > 0:
		if len(rsort) > 0:
			nint = nint - 1
			rsort.pop(0)
		n = n + 1
		rint.append(e)
	elif abs(e) in rint:
		n = n - 1
		rint.remove(abs(e))
	else:
		nint = nint + 1
		ntot = ntot + 1
		rsort.append(abs(e))
ntot = max(ntot, nint + n)
print(ntot)


n = int(input())
currenly_in = set()
visitors_in = [0] * (n + 1)
for i in range(1, n + 1):
	(sign, id) = input().split()
	if sign == '+':
		currenly_in.add(id)
		visitors_in[i] = visitors_in[i - 1] + 1
	else:
		if id not in currenly_in:
			for j in range(0, i):
				visitors_in[j] += 1
		visitors_in[i] = visitors_in[i - 1] - 1
		currenly_in.discard(id)
print(max(visitors_in))


n = int(input())
p = [0] * (n + 1)
visitor = {}
for i in range(1, n + 1):
	(sgn, log) = input().split()
	if sgn == '-' and (not log in visitor.keys()):
		for j in range(i - 1, -1, -1):
			p[j] += 1
	if sgn == '+':
		p[i] = 1 + p[i - 1]
		visitor[log] = 1
	else:
		p[i] = -1 + p[i - 1]
		visitor[log] = 0
print(max(p))


n = int(input())
num = 0
here = dict()
for i in range(n):
	(a, b) = map(str, input().split())
	if a == '+':
		here.setdefault(b, True)
		num = max(num, len(here))
	elif a == '-':
		if b not in here.keys():
			num += 1
		elif here[b]:
			here.pop(b)
print(num)


from collections import Counter
from collections import defaultdict

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

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

def pt(x):
	print(x)

def ip():
	return input()

def it():
	return int(input())

def sl(x):
	return [t for t in x]

def spl(x):
	return x.split()

def aj(liste, item):
	liste.append(item)

def bin(x):
	return '{0:b}'.format(x)

def listring(l):
	return ' '.join([str(x) for x in l])

def printlist(l):
	print(' '.join([str(x) for x in l]))
n = it()
maxx = 0
E = {}
length = 0
deja = defaultdict(int)
for i in range(n):
	b = ip().split()
	(x, y) = (b[0], int(b[1]))
	if x == '+':
		length += 1
		maxx = max(maxx, length)
		deja[y] = 1
	if x == '-':
		if deja[y] != 1:
			maxx += 1
		else:
			length -= 1
		maxx = max(maxx, length)
print(maxx)


n = int(input())
s = set()
c = 0
m = 0
for i in range(n):
	(x, r) = input().split()
	if x == '+':
		c += 1
		if c > m:
			m = c
		s.add(r)
	elif x == '-':
		if r in s:
			c -= 1
			s.discard(r)
		else:
			m += 1
print(m)


lines = int(input())
room = []
baseLine = 0
personNo = 0
mostNo = 0
for i in range(lines):
	strs = input()
	person = strs.split(' ')[1]
	if '+' in strs:
		room.append(person)
		personNo = personNo + 1
	elif person not in room:
		baseLine = baseLine - 1
		personNo = personNo - 1
	else:
		room.remove(person)
		personNo = personNo - 1
	if mostNo < personNo:
		mostNo = personNo
print(mostNo - baseLine)


import sys
a = {}
n = int(input())
amount = 0
max = 0
for i in range(n):
	x = input().split()
	if x[0] == '+':
		a[x[1]] = True
		amount += 1
	elif a.get(x[1]):
		amount -= 1
	else:
		max += 1
	if max < amount:
		max = amount
print(max)


n = int(input())
s = set()
res = 0
for i in range(n):
	(ch, a) = input().split()
	if ch == '+':
		s.add(a)
		res = max(res, len(s))
	elif a in s:
		s.remove(a)
	else:
		res += 1
print(res)


import math
import os
from io import BytesIO, IOBase
import sys
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')
n = int(input())
beginning = 0
visitors = {}
best = 0
for i in range(n):
	(s, num) = input().split()
	if s == '+':
		visitors[num] = 1
		best = max(len(visitors), best)
	elif num in visitors:
		del visitors[num]
	else:
		best += 1
print(best)


n = int(input())
otv = 0
into = set()
for i in range(n):
	s = input().split()
	if s[0] == '+':
		into.add(int(s[1]))
		otv = max(otv, len(into))
	elif s[0] == '-':
		if int(s[1]) in into:
			into.discard(int(s[1]))
		else:
			otv += 1
print(otv)


n = int(input())
c = 0
maxc = 0
dict = {}
while n:
	(sign, regid) = input().split()
	if sign == '+':
		c += 1
		dict[regid] = True
	elif regid in dict and dict[regid]:
		c -= 1
		dict[regid] = False
	else:
		maxc += 1
	if c > maxc:
		maxc = c
	n -= 1
print(maxc)


n = int(input())
people = []
current = 0
num = [0]
for i in range(n):
	(x, y) = input().split()
	if x == '+':
		people.append(y)
		current += 1
		num.append(current)
	else:
		try:
			people.remove(y)
			current -= 1
		except:
			num = [*map(lambda x: x + 1, num)]
		num.append(current)
print(max(num))


n = int(input())
list1 = []
ls = []
for i in range(n):
	(c, x) = input().strip().split(' ')
	(c, x) = (str(c), int(x))
	list1.append([c, x])
	ls.append(x)
de = []
for i in range(n):
	if list1[i][0] == '-':
		if list1[i][1] not in ls[0:i]:
			de.append(list1[i][1])
lmax = len(de)
for i in range(n):
	if list1[i][0] == '+':
		de.append(list1[i][1])
		if len(de) > lmax:
			lmax = len(de)
	elif list1[i][0] == '-':
		de.remove(list1[i][1])
print(lmax)


n = int(input())
st = set()
m_so_far = 0
for _ in range(n):
	(x, i) = input().split()
	if x == '-':
		if i in st:
			st.remove(i)
		else:
			m_so_far += 1
	else:
		st.add(i)
	m_so_far = max(m_so_far, len(st))
print(m_so_far)


(n, lst, mx, a) = (int(input()), [0] * 1000000, 0, [])
for i in range(n):
	a.append(input())
for i in range(n):
	if a[i][0] == '+':
		lst[int(a[i][2:]) - 1] = 1
	elif not lst[int(a[i][2:]) - 1]:
		mx += 1
ans = mx
for i in range(n):
	if a[i][0] == '+':
		mx += 1
		ans = max(mx, ans)
	else:
		mx -= 1
print(ans)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = ii()
l1 = []
l2 = []
for i in range(n):
	(x, y) = input().split()
	l1.append(x)
	l2.append(int(y))
im = 0
for i in range(n):
	if l2[:i + 1].count(l2[i]) == 1 and l1[i] == '-':
		im += 1
mx = 0
for i in l1:
	mx = max(mx, im)
	if i == '+':
		im += 1
	else:
		im -= 1
	mx = max(mx, im)
print(mx)


import sys
import collections

def solve(xs):
	d = collections.defaultdict(int)
	already_in = collections.defaultdict(bool)
	for (sign, person) in xs:
		if sign == '+':
			d[person] += 1
		else:
			d[person] -= 1
		if d[person] < 0:
			already_in[person] = True
	number = sum(dict(already_in).values())
	history = [number]
	for (sign, person) in xs:
		if sign == '+':
			number += 1
		else:
			number -= 1
		history.append(number)
	return max(history)

def main():
	n = int(input())
	xs = [input().strip().split() for _ in range(n)]
	result = solve(xs)
	print(result)

def __starting_point():
	main()
__starting_point()


import sys
input = sys.stdin.readline
(n, cnt, res) = (int(input()), 0, 0)
s = [0 for i in range(int(1000000.0) + 5)]
for i in range(n):
	(op, x) = input()[:-1].split()
	x = int(x)
	if op == '+':
		s[x] = 1
		cnt += 1
	elif s[x] == 0:
		res += 1
	else:
		s[x] = 0
		cnt -= 1
	if cnt > res:
		res = cnt
print(res)


n = int(input())
a = set()
ans = 0
for _ in range(n):
	(s, m) = input().split()
	if s == '+':
		a.add(m)
		ans = max(ans, len(a))
	elif not m in a:
		ans += 1
	else:
		a.remove(m)
print(ans)


(n, visitors) = (int(input().strip()), [])
mn = 0
for i in range(n):
	inp = input().strip()
	if inp[0] == '+':
		if len(visitors) >= mn:
			mn += 1
		visitors.append(inp[2:])
	elif inp[0] == '-':
		try:
			visitors.remove(inp[2:])
		except:
			mn += 1
print(mn)


from math import floor, sqrt
from sys import stdin

def solve(n, arr):
	return
for _ in range(1):
	n = int(input())
	log = [0] * 1000001
	total = 0
	occupied = 0
	for i in range(n):
		(a, b) = map(str, input().split())
		b = int(b)
		if a == '+':
			log[b] = 1
			if occupied == total:
				total += 1
				occupied += 1
			else:
				occupied += 1
		elif log[b] == 0:
			total += 1
		else:
			occupied -= 1
	print(total)


A = dict()
B = dict()
n = int(input())
C = [0] * n
answer = 0
for i in range(n):
	a = input().split()
	if a[0] == '+':
		C[i] = 1
	if a[0] == '+':
		A[a[1]] = 1
	elif a[1] in A and A[a[1]] == 1:
		A[a[1]] = 0
	else:
		answer += 1
		B[a[1]] = 1
per = 0
for i in range(len(C)):
	per = max(per, answer)
	if C[i] == 1:
		answer += 1
	else:
		answer -= 1
print(max(per, answer))


from sys import stdin
from collections import defaultdict
input = stdin.readline
T = 1
for t in range(1, T + 1):
	n = int(input())
	yet = defaultdict(lambda : 0)
	pre = [0 for x in range(120)]
	for i in range(1, n + 1):
		(type_, id_) = map(str, input().split())
		id_ = int(id_)
		if type_ == '+':
			pre[i] += 1
			yet[id_] = True
		else:
			if yet[id_] == False:
				pre[0] += 1
				yet[id_] = True
			pre[i] -= 1
	ans = pre[0]
	for i in range(1, n + 1):
		pre[i] += pre[i - 1]
		ans = max(ans, pre[i])
	print(ans)


c = []
n = int(input())
ma = k = 0
for i in range(n):
	(a, b) = input().split()
	if a < '-':
		k += 1
		c += [b]
	elif c.count(b):
		k -= 1
		c.remove(b)
	else:
		ma += 1
	ma = max(ma, k)
print(ma)


d = {}
z = 0
a = 0
n = int(input())
for e in range(n):
	(u, v) = input().split()
	v = int(v)
	if u == '+':
		z += 1
		d[v] = 1
	elif d.get(v) == 1:
		d[v] = 0
		z -= 1
	else:
		a += 1
	a = max(a, z)
print(a)


from sys import stdin, stdout
input = stdin.readline
n = int(input())
r = [input().split() for _ in range(n)]
for i in range(n):
	r[i][1] = int(r[i][1])
v = [False] * (10 ** 6 + 1)
cur = 0
for i in range(n):
	if r[i][0] == '+':
		v[r[i][1]] = True
	elif not v[r[i][1]]:
		cur += 1
v = [False] * (10 ** 6 + 1)
ans = cur
for i in range(n):
	if r[i][0] == '+':
		if not v[r[i][1]]:
			v[r[i][1]] = True
			cur += 1
	elif v[r[i][1]]:
		v[r[i][1]] = False
		cur -= 1
	else:
		cur -= 1
	ans = max(ans, cur)
stdout.write(str(ans))


count = int(input())
lt = []
m = 0
for i in range(count):
	t = input().split(' ')
	if t[0] == '+':
		lt.append(t[1])
		if m < len(lt):
			m = len(lt)
	elif t[1] in lt:
		del lt[lt.index(t[1])]
	else:
		m += 1
print(m)


n = int(input())
a = []
for i in range(n):
	s = input()
	a.append(s)
lst = [0] * 1000000
before = []
for i in range(n):
	sign = a[i][0]
	val = int(a[i][2:])
	if sign == '+':
		lst[val - 1] = 1
	elif not lst[val - 1]:
		before.append(val)
mx = len(before)
ans = mx
for i in range(n):
	sign = a[i][0]
	val = int(a[i][2:])
	if sign == '+':
		mx += 1
		ans = max(mx, ans)
	else:
		mx -= 1
print(ans)


import math
from collections import defaultdict, deque
from bisect import bisect_left, bisect_right
import time
n = int(input())
x = defaultdict(lambda : 0)
curr = 0
ans = 0
for _ in range(n):
	s = input()
	person = int(s[2:])
	if s[0] == '+':
		curr += 1
		x[person] += 1
		ans = max(ans, curr)
	elif x[person] == 0:
		ans += 1
	else:
		x[person] = 0
		curr -= 1
print(ans)


(m, p) = (0, [])
for _ in range(int(input())):
	i = input().split()
	if i[0] == '+':
		p.append(i[1])
	elif i[1] in p:
		p.remove(i[1])
	else:
		m += 1
	m = max(m, len(p))
print(m)


n = int(input())
seats = [False for x in range(1, 1000010)]
ans = 0
state = 0
for x in range(n):
	(di, idd) = input().split()
	idd = int(idd)
	if di == '+':
		seats[idd] = True
		state += 1
		ans = max(ans, state)
	elif di == '-':
		if seats[idd] == False:
			ans += 1
		else:
			state -= 1
			ans = max(ans, state)
			seats[idd] = False
print(ans)


x = set()
r = 0
i = []
for _ in range(int(input())):
	s = input()
	i.append(s)
	if s[0] == '+':
		x.add(s[2:])
	elif s[2:] in x:
		x.remove(s[2:])
	else:
		i.insert(0, '+ ' + s[2:])
x = set()
for s in i:
	if s[0] == '+':
		x.add(s[2:])
	else:
		x.remove(s[2:])
	r = max(r, len(x))
print(r)


m = 0
s = set()
n = int(input())
for i in range(n):
	(flag, number) = input().strip().split()
	if flag == '+':
		s.add(number)
		m = max(m, len(s))
	elif number in s:
		s.remove(number)
	else:
		m += 1
print(m)


n = int(input())
lis = [0] * (10 ** 6 + 1)
cou = c = crr = ma = 0
for i in range(n):
	a = input()
	no = int(a[2:])
	if a[0] == '+':
		crr += 1
		lis[no] = 1
	elif a[0] == '-':
		if lis[no] == 0:
			c += 1
			lis[no] == 1
		else:
			crr -= 1
	if ma < crr:
		ma = crr
	ma += c
	c = 0
print(ma)


n = int(input())
readers = []
times = [0] * (n + 1)
for i in range(n):
	(action, rnum) = input().split()
	if action == '-':
		if rnum not in readers:
			readers.append(rnum)
			for j in range(i + 1):
				times[j] += 1
		else:
			for j in range(i + 1, n + 1):
				times[j] -= 1
	elif action == '+':
		for j in range(i + 1, n + 1):
			times[j] += 1
		if rnum not in readers:
			readers.append(rnum)
print(max(times))


import os
import sys
from io import BytesIO, IOBase
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')
from collections import defaultdict
from math import ceil, floor, sqrt, log2, gcd
from heapq import heappush, heappop
from bisect import bisect
import sys
abc = 'abcdefghijklmnopqrstuvwxyz'
d = defaultdict(int)
n = int(input())
c = 0
maxi = 0
for _ in range(n):
	(a, b) = input().split()
	b = int(b)
	if a == '+':
		c += 1
		maxi = max(c, maxi)
		d[b] = 1
	elif a == '-':
		if d[b] == 1:
			d[b] = 0
			c -= 1
		else:
			maxi += 1
print(maxi)


num = int(input().strip())
res = 0
set_ = {}
for i in range(num):
	input_ = input().strip()
	(sy, str_) = input_.split()
	if sy == '+':
		if str_ not in set_:
			set_[str_] = 1
			curr_len = len(set_)
	elif str_ not in set_:
		curr_len = res + 1
	else:
		set_.pop(str_)
	if curr_len >= res:
		res = curr_len
print(res)


s = set()
cap = 0
n = int(input())
for _ in range(n):
	(c, i) = input().split()
	if c == '+':
		s.add(i)
		cap = max(cap, len(s))
	elif i in s:
		s.remove(i)
	else:
		cap += 1
print(cap)


n = int(input())
c = []
d = 0
while n:
	n = n - 1
	(a, b) = input().split()
	if a == '-':
		if b in c:
			c.remove(b)
		else:
			d = d + 1
	else:
		c.append(b)
	d = max(d, len(c))
print(d)