Little kids, Jack and Evan like playing their favorite game Glass-and-Stone. Today they want to play something new and came across Twitter on their father's laptop.

They saw it for the first time but were already getting bored to see a bunch of sentences having at most 140 characters each. The only thing they liked to play with it is, closing and opening tweets.

There are N tweets on the page and each tweet can be opened by clicking on it, to see some statistics related to that tweet. Initially all the tweets are closed. Clicking on an open tweet closes it and clicking on a closed tweet opens it. There is also a button to close all the open tweets. Given a sequence of K clicks by Jack, Evan has to guess the total number of open tweets just after each click. Please help Evan in this game.

-----Input-----
First line contains two integers N K, the number of tweets (numbered 1 to N) and the number of clicks respectively (1 ≤ N, K ≤ 1000). Each of the following K lines has one of the following.

- CLICK X , where X is the tweet number (1 ≤ X ≤ N)
- CLOSEALL

-----Output-----
Output K lines, where the ith line should contain the number of open tweets just after the ith click.

-----Example-----
Input:
3 6
CLICK 1
CLICK 2
CLICK 3
CLICK 2
CLOSEALL
CLICK 1

Output:
1
2
3
2
0
1

Explanation:

Let open[x] = 1 if the xth tweet is open and 0 if its closed.

Initially open[1..3] = { 0 , 0 , 0 }. Here is the state of open[1..3] after each click and corresponding count of open tweets.

CLICK 1 : { 1, 0, 0 }, open count = 1

CLICK 2 : { 1, 1, 0 }, open count = 2

CLICK 3 : { 1, 1, 1 }, open count = 3

CLICK 2 : { 1, 0, 1 }, open count = 2

CLOSEALL : { 0, 0, 0 }, open count = 0

CLICK 1 : { 1, 0, 0 }, open count = 1

Difficulty: UNKNOWN_DIFFICULTY

Solutions:
def getInput():
	N_k = input().split()
	N = int(N_k[0])
	k = int(N_k[1])
	list = []
	output = []
	count = 0
	for i in range(0, k):
		val = input()
		if val != 'CLOSEALL':
			val = val.split()
			val = int(val[1])
			if val not in list:
				count = count + 1
				list.append(val)
			else:
				list.remove(val)
				count = count - 1
		else:
			count = 0
			while len(list) > 0:
				list.pop()
		output.append(count)
	for each in output:
		print(each)
getInput()


(N, K) = list(map(int, input().split()))
estado = [False] * N
numAbiertos = 0
for _l in range(K):
	cmd = input().strip()
	if cmd == 'CLOSEALL':
		estado = [False] * N
		numAbiertos = 0
	else:
		num = int(cmd.split()[1]) - 1
		if estado[num]:
			estado[num] = False
			numAbiertos -= 1
		else:
			estado[num] = True
			numAbiertos += 1
	print(numAbiertos)


import string
a = input()
b = a.split()
n = int(b[1])
array = [0] * int(b[0])
for i in range(0, n):
	c = input()
	d = c.split()
	if d == ['CLOSEALL']:
		array = [0] * int(b[0])
	else:
		e = int(d[1])
		if array[e - 1] == 0:
			array[e - 1] = 1
		else:
			array[e - 1] = 0
	f = array.count(1)
	print(f)


open_tweets = []
string = input()
(a, b) = string.split(' ')
n = int(a)
k = int(b)
counter = 0
for x in range(k):
	command = input()
	if command == 'CLOSEALL':
		counter = 0
		open_tweets = []
		print(counter)
		continue
	(click, tweetnum) = command.split(' ')
	if tweetnum in open_tweets:
		open_tweets.remove(tweetnum)
		counter -= 1
		print(counter)
	else:
		open_tweets.append(tweetnum)
		counter += 1
		print(counter)


(tweets, clicks) = list(map(int, input().split()))
openl = []
for i in range(clicks):
	action = input().upper()
	if action == 'CLOSEALL':
		openl = []
		print(0)
	elif action not in openl:
		openl.append(action)
		print(len(openl))
	elif action in openl:
		openl.remove(action)
		print(len(openl))


import sys

def main():
	s = sys.stdin.readline
	(n, k) = list(map(int, s().split()))
	save = {}
	for i in range(1, n + 1):
		save[i] = 0
	for i in range(k):
		try:
			(c, v) = s().split()
			v = int(v)
			if save[v] == 1:
				save[v] = 0
			elif save[v] == 0:
				save[v] = 1
			ans = 0
			for i in range(1, n + 1):
				if save[i] == 1:
					ans += 1
			print(ans)
		except:
			for i in range(1, n + 1):
				save[i] = 0
			print(0)

def __starting_point():
	main()
__starting_point()


(n, k) = list(map(int, input().split()))
hit = [0] * n
count = 0
for i in range(k):
	cmd = input().split()
	if cmd[0] == 'CLICK':
		idx = int(cmd[1]) - 1
		if hit[idx] == 0:
			hit[idx] = 1
			count += 1
		else:
			hit[idx] = 0
			count -= 1
	else:
		hit = [0] * n
		count = 0
	print(count)


(n, k) = list(map(int, input().split()))
arr = [True for i in range(n)]
open = 0
for i in range(k):
	temp = input().split()
	if temp[0] == 'CLICK':
		cl = int(temp[1]) - 1
		if arr[cl]:
			open += 1
			arr[cl] = False
		else:
			open -= 1
			arr[cl] = True
	else:
		open = 0
		arr = [True for i in range(n)]
	print(open)


import sys
(N, K) = list(map(int, sys.stdin.readline().split()))
open = [False for i in range(N + 1)]
count = 0
for i in range(K):
	line = sys.stdin.readline().split()
	if len(line) == 1:
		count = 0
		open = [False for i in range(N + 1)]
	else:
		(action, num) = line
		num = int(num)
		if open[num]:
			count -= 1
		else:
			count += 1
		open[num] = not open[num]
	print(count)


(n, k) = list(map(int, input().split()))
tweets = [False] * n
count = 0
for _ in range(k):
	stuff = input().split()
	if stuff[0] == 'CLICK':
		i = int(stuff[1]) - 1
		if tweets[i]:
			count -= 1
		else:
			count += 1
		tweets[i] = not tweets[i]
	else:
		tweets = [False] * n
		count = 0
	print(count)


s = input().split()
n = int(s[0])
k = int(s[1])
tweet = [0] * k
for t in range(k):
	s = input().split()
	if len(s) == 1:
		tweet = [0] * k
		print(0)
		continue
	s = int(s[1])
	if tweet[s - 1] == 1:
		tweet[s - 1] = 0
	else:
		tweet[s - 1] = 1
	ans = 0
	for i in range(k):
		if tweet[i] == 1:
			ans += 1
	print(ans)


def main():
	(N, K) = list(map(int, input().strip().split()[:2]))
	T = [0] * N
	for k in range(K):
		X = input().strip().split()
		if len(X) == 2:
			T[int(X[1]) - 1] = 1 - T[int(X[1]) - 1]
		else:
			T = [0] * N
		print(T.count(1))
main()


import sys
opened = set()
first = True
for line in sys.stdin:
	if first:
		first = False
		continue
	tok = line.split()
	if len(tok) == 1:
		opened = set()
	else:
		x = int(tok[1])
		if x in opened:
			opened.remove(x)
		else:
			opened.add(x)
	print(len(opened))