Problem:


Score : 300 points

Problem Statement

You are playing the following game with Joisino.

Initially, you have a blank sheet of paper.

Joisino announces a number. If that number is written on the sheet, erase the number from the sheet; if not, write the number on the sheet. This process is repeated N times.

Then, you are asked a question: How many numbers are written on the sheet now?

The numbers announced by Joisino are given as A_1, ... ,A_N in the order she announces them. How many numbers will be written on the sheet at the end of the game?

Constraints

1≤N≤100000

1≤A_i≤1000000000(=10^9)

All input values are integers.

Input

Input is given from Standard Input in the following format:

N
A_1
:
A_N

Output

Print how many numbers will be written on the sheet at the end of the game.

Sample Input 1

3
6
2
6

Sample Output 1

1

The game proceeds as follows:

6 is not written on the sheet, so write 6.

2 is not written on the sheet, so write 2.

6 is written on the sheet, so erase 6.

Thus, the sheet contains only 2 in the end. The answer is 1.

Sample Input 2

4
2
5
5
2

Sample Output 2

0

It is possible that no number is written on the sheet in the end.

Sample Input 3

6
12
22
16
22
18
12

Sample Output 3

2



Sample input:
3
6
2
6


Sample output:
1

Submission status: Accepted

Solution code:
n=int(input())

count_dict={}

for i in range(n):
    new=int(input())
    if new in count_dict:
        count_dict[new]+=1
    else:
        count_dict[new]=1
ans=0
for i in count_dict.values():
    if i%2==1:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
import collections
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))
    
cnt = collections.Counter(A)
ans = 0
for v in cnt.values():
    if v % 2 != 0:
        ans += 1
        
print(ans)

Submission status: Accepted

Solution code:
import sys
import collections

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

tin=lambda : map(int, input().split())
lin=lambda : list(tin())
mod=1000000007

#+++++

def main():
	n = int(input())
	#b , c = tin()
	#s = input()
	dd=collections.defaultdict(lambda :0)
	for _ in range(n):
		v = int(input())
		dd[v] += 1
	
	ret = 0
	for k in dd:
		if dd[k] % 2 == 1:
			ret += 1
	print(ret)
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Submission status: Accepted

Solution code:
import collections 
N = int(input())
lsA = []
for i in range(N):
    lsA.append(int(input()))
counterA = collections.Counter(lsA)
ans = 0
for i in counterA.values():
    ans += i%2
print(ans)

Submission status: Accepted

Solution code:
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint
from statistics import mean,median,mode

INF = float("inf")

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def mycount(ls,x):
    # lsはソート済みであること
    l = bisect_left(ls,x)
    r = bisect_right(ls,x)
    return (r-l)

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

def I():
    return int(input())

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

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

def CI(n):
    return [ int(input()) for _ in range(n) ]

def LI(n):
    return [ list(map(int,input().split())) for _ in range(n) ]

def S():
    return input()

def MS():
    return input().split()

def RS():
    return list(input())

def CS(n):
    return [ input() for _ in range(n) ]

def LS(n):
    return [ list(input()) for _ in range(n) ]

ddict = defaultdict(lambda: 0)
# ddict = defaultdict(lambda: 1)
# ddict = defaultdict(lambda: int())
# ddict = defaultdict(lambda: list())
# ddict = defaultdict(lambda: float())

n = I()
a = CI(n)

for i in range(n):
    ddict[a[i]] += 1
# print(ddict.items())
    
ans = 0
for t in ddict.items():
    m = t[0]
    c = t[1]
    if c%2==0:
        pass
    else:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

n = ri()
cnt = 0
for v in collections.Counter([ri() for _ in range(n)]).values():
    if v&1:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
a = list()
for i in range(n):
    a.append(int(input()))
import collections
b = collections.Counter(a)
c = list(map(lambda x: x%2, list(b.values())))
print(c.count(1))

Submission status: Accepted

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()

i = 0
ans = 0
while i < N:
    tmp = A[i]
    count = 0
    while i < N and A[i] == tmp:
        count += 1
        i += 1
    ans += count % 2

print(ans)

Submission status: Accepted

Solution code:
#20 C - Write and Erase
N = int(input())
A = [int(input()) for _ in range(N)]

paper = set()
for a in A:
    if not(a in paper):
        paper.add(a)
    else:
        paper.remove(a)
print(len(paper))

Submission status: Accepted

Solution code:
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
a.sort()
jud = 1
q = a[0]
ans = 0
for i in range(1,n):
  if(q==a[i]):
    jud += 1
  else: 
    if(jud%2==1):
      ans += 1
    jud = 1
    q = a[i]
if (jud%2==1):
  ans += 1
if(n==1):
  ans = 1
print(ans)

Submission status: Accepted

Solution code:
from collections import  Counter

n = int(input())
A = [int(input()) for _ in range(n)]
cnt_A = Counter(A)

ans = 0
for v in cnt_A.values():
    if v % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    ans = set()
    for _ in range(n):
        a = int(input())
        if a in ans:
            ans.discard(a)
        else:
            ans.add(a)

    print(len(ans))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import collections
dic = collections.defaultdict(int)
ans = 0
n = int(input())
for i in range(n):
  dic[int(input())] += 1
for key in dic.keys():
  if dic[key] % 2 == 1:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]

d = {}
#key設定
for i in A:
    d[i]=0
#数字keyが偶数回出たら0,奇数回出たら1になるようにvalueを設定
for i in A:
    if d[i]==1:
        d[i]=0
    else:
        d[i]=1
    
print(sum(d.values()))

Submission status: Accepted

Solution code:
#!/usr/bin/env python

n = int(input())
a = [int(input()) for _ in range(n)]

d = {}
for i in range(n):
    if a[i] not in d:
        d[a[i]] = 1 
    else:
        d[a[i]] += 1

ans = 0 
for s in d.values():
    if s%2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = [0] * N
for i in range(N):
    A[i] = int(input())

from collections import Counter
c = Counter(A)
cc = list(c.values())
ans = 0
for i in range(len(cc)):
    if cc[i] % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
from collections import *
n=int(input())
l=[]
for i in range(n):
    l.append(int(input()))
d=defaultdict(int)
for i in l:
    d[i]+=1
c=0
for i in d:
    if(d[i]%2==1):
        c=c+1
print(c)

Submission status: Accepted

Solution code:
import collections
import numpy as np
n = int(input())
a = []
for _ in range(n):
    a.append(int(input()))
ans = collections.Counter(a)
c=list(ans.values())
c=np.array(c)
print(sum(c%2))

Submission status: Accepted

Solution code:
import collections
n=int(input())
a=[]
for i in range(n):
   A=int(input()) 
   a.append(A)
c=collections.Counter(a)
ans=0
for i in c:
    if c[i]%2==1:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
import collections
a = int(input())
s = [input() for i in range(a)]
c = collections.Counter(s)
b = []
for myvalue in c.values():
    b.append(myvalue)

d = len(b)
ans = int(0)
for i in range(int(d)):
    if b[i] % 2 == 0:
        pass
    else:
        ans += 1
        
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
d={}
for i in range(n):
  A=int(input())
  if A not in d:
    d[A]=1
  elif d[A]==1:
    d[A]=0
  else:
    d[A]=1
print(sum(d.values()))

Submission status: Accepted

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]

paper = set()
for a in A:
    if a in paper:
        paper.remove(a)
    else:
        paper.add(a)
ans = len(paper)
print(ans)

Submission status: Accepted

Solution code:
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n = I()
    dic = collections.defaultdict(int)
    ans = 0
    for _ in range(n):
        a = I()
        dic[a] += 1
    for key,value in dic.items():
        if value%2 == 1:
            ans += 1
    print(ans)
main()

Submission status: Accepted

Solution code:
import collections
a=int(input())
b=[int(input()) for i in range(a)]

n=collections.Counter(b)
m,ans=zip(*n.most_common())
ans=[i for i in ans if i%2==1]
print(len(ans))

Submission status: Accepted

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]
dic = {num: 0 for num in set(A)}
for i in range(N):
    dic[A[i]] = 1 if dic[A[i]]==0 else 0
ans = 0
for num in set(A):
    ans += dic[num]
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
A=[int(input()) for _ in range(n)]
B={}
for i in A:
    if i in B:
        B[i]=(1+B[i])%2
    else:
        B[i]=1
print(sum(B.values()))

Submission status: Accepted

Solution code:
N = int(input())
numbers = {}
for i in range(N):
    x = int(input())
    if x in numbers:
        del numbers[x]
    else:
        numbers[x] = 1
print(len(numbers))

Submission status: Accepted

Solution code:
n = int(input())

d = {}
for i in range(n):
    a = int(input())
    if a in d:
        d[a] ^= 1
    else:
        d[a] = 1
print(sum(d.values()))

Submission status: Accepted

Solution code:
import collections
n=int(input())
l = [input() for i in range(n)]
c = collections.Counter(l)
ans = 0

for x,y in c.items():
    if y%2 != 0:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
l = [int(input()) for _ in range(N)]

c = Counter(l)

ans = 0
for i, j in zip(c.keys(), c.values()):
    if j % 2 != 0:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = INT()
    A = [INT() for _ in range(N)]

    ctr = Counter(A)
    ans = 0
    for c in ctr.values():
        if c % 2 == 1:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect, bisect_left, bisect_right

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = [INT() for i in range(N)]

S = set(A)
C = Counter(A)

cnt = 0
for s in S:
    if C[s] % 2 != 0:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import collections as c;print(sum([i%2!=0 for i in c.Counter([int(input()) for _ in range(int(input()))]).values()]))

Submission status: Accepted

Solution code:
import collections as c
print(sum([1 for i in c.Counter([int(input()) for _ in range(int(input()))]).values() if i%2!=0]))

Submission status: Accepted

Solution code:
# coding = SJIS

n = int(input())
a = [int(input()) for i in range(n)]
ans = 0

a.sort()

i = 0

while i < n:
    ko = 1
    while (i + ko) < n and a[i] == a[i + ko]:
        ko += 1
    if ko % 2 == 1:
        ans += 1
    i += ko

print(ans)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = [INT() for _ in range(N)]
count = [0]*N
zipped = {x:i for i, x in enumerate(set(A))}
A = [zipped[x] for x in A]

for x in A:
    count[x] += 1

print(sum(x%2==1 for x in count))

Submission status: Accepted

Solution code:
import collections


def solve():
    pass


n = int(input())
A = []
for i in range(n):
    a = int(input())
    A.append(a)

c = collections.Counter(A)
cnt = 0
for k, v in c.items():
    if v % 2 == 0: continue
    else: cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
A = list(int(input()) for _ in range(N))
s = set()
for i in A:
    if i not in s:
        s.add(i)
    else:
        s.remove(i)
print(len(s))

Submission status: Accepted

Solution code:
import collections
N=int(input())
L=list()
for i in range(N):
  L.append(int(input()))
c = collections.Counter(L)
a=list(c.values())
a=[i%2 for i in a]
print(sum(a))

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    A = [int(input()) for i in range(N)]

    A = sorted(A)

    i = 0
    k = 0
    ans = 0

    while i < N:
        tmp = A[i]
        n = 0
        while k < N and tmp == A[k]:
            n += 1
            k += 1
        i = k
        if n%2 == 1:
            ans += 1

    print(ans)
            
        


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
#
# abc073 c
#

import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3
6
2
6"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4
2
5
5
2"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """6
12
22
16
22
18
12"""
        output = """2"""
        self.assertIO(input, output)


def resolve():
    N = int(input())
    A = [int(input()) for _ in range(N)]

    AM = {}
    for a in A:
        AM.setdefault(a, 0)
        AM[a] += 1

    ans = 0
    for v in AM.values():
        if v % 2 != 0:
            ans += 1

    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

Solution code:
N=int(input())
d={}

for i in range(N):
    a=int(input())
    d[a] = not(d.get(a, 0))
print(sum(d.values()))

Submission status: Accepted

Solution code:
from collections import defaultdict
n = int(input())
dd = defaultdict(int)
for i in range(n):
  s = int(input())
  dd[s]+=1
res = 0
for i in dd.keys():
  if dd[i]%2:
    res+=1
print(res)

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))
#sA = set(A)
ans = 0
for num in Counter(A).values():
    #print(num)
    if num % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()
    num_list = i_row(n)

    num_counter = Counter(num_list)

    count = 0

    for v in num_counter.values():
        if v % 2 == 1:
            count += 1

    print(count)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = dict()

    for _ in range(N):
        num = int(input())
        if num in A:
            del A[num]
        else:
            A[num] = 1

    print(len(A))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:

from collections import Counter
N = int(input())
A = [int(input()) for _ in range(N)]
ca = Counter(A)

ans = 0
for v in ca.values():
  if v%2:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = [input() for _ in range(N)]
d = {}
for i in range(N):
    if a[i] not in d:
        d[a[i]] = 1
    else:
        d.pop(a[i])
print(len(d))

Submission status: Accepted

Solution code:
dic = {}
N = int(input())

for i in range(N):
    a = int(input())

    if a in dic:
        dic.pop(a)
    else:
        dic[a]=1

print(len(dic))

Submission status: Accepted

Solution code:
n = int(input())
l = {}
ans = 0
for _ in range(n):
    a = int(input())
    if a in l:
        l[a] += 1
    else:
        l[a] = 1
for v in l.values():
    if v % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import collections
N = int(input())
a = [int(input()) for i in range(N)]
c=collections.Counter(a)
cnt=0
for i in c:
    if c[i]%2==1:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
import collections
n=int(input())
num=[]
l=[]
count=0
for _ in range(n):
    a=int(input())
    l.append(a)
l=collections.Counter(l)
for i in l.values():
    if i%2!=0:
        count+=1
print(count)

Submission status: Accepted

Solution code:
import collections
print(len(list(filter(lambda c: c % 2 == 1, list(collections.Counter([int(input()) for i in range(int(input()))]).values())))))

Submission status: Accepted

Solution code:
N = int(input())
s = set()
for i in range(N):
    s ^= {int(input())}
print(len(s))

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
a = [int(input()) for i in range(n)]
b = Counter(a).values()
c = [x for x in b if x % 2 != 0]
print(len(c))

Submission status: Accepted

Solution code:
n = int(input())
temp_set = set()
for _ in range(n):
    a = input()
    if a in temp_set:
        temp_set.discard(a)
    else:
        temp_set.add(a)
print(len(temp_set))

Submission status: Accepted

Solution code:
#https://atcoder.jp/contests/abc073/tasks/abc073_c
N = int(input())
N_Dict = {}
for i in range(N):
    moji = str(input())
    if moji in N_Dict:
        N_Dict.pop(moji)
    else:
        N_Dict[moji] = 1
print(len(N_Dict))

Submission status: Accepted

Solution code:
n = int(input())
dic = {}
for i in range(n):
    a = int(input())
    dic.setdefault(a,0)
    dic[a] += 1
    if dic[a] == 2:
        dic.pop(a)

print(len(dic))

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    indic = dict()
    ans = 0

    for _ in range(n):
        a = int(input())
        if a in indic:
            indic[a] += 1
        else:
            indic[a] = 1
    for k in indic:
        if indic[k] % 2 != 0:
            ans += 1
    
    print(ans)




if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
from collections import Counter
from typing import List


def main(n: int, a: List[int]):
    c = Counter(a)
    ans = 0

    for t in c.values():
        if t % 2 == 1:
            ans += 1

    print(ans)


if __name__ == "__main__":
    n = int(input())
    a = [int(input()) for _ in range(n)]

    main(n, a)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]

dic = {}

for a in A:
    if a in dic:
        dic[a] += 1

    else:
        dic[a] = 1

ans = 0

for a in dic:
    if dic[a] % 2 != 0:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
s = set()
for i in range(n):
    a = int(input())

    if a not in s:
        s.add(a)
    else:
        s.remove(a)

print(len(s))

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline
d = {}
for _ in range(int(input())):
    i = int(input())
    if i in d:
        del d[i]
    else:
        d[i] = True
print(len(d))

Submission status: Accepted

Solution code:
n=int(input())
A=[]
for i in range(n):
    A.append(input())
import collections
B = collections.Counter(A)
C=list(set(A))
cnt=0
for j in range(len(C)):
    if B[C[j]] %2 != 0:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
a1 = [int(input()) for i in range(n)]
from collections import Counter
a = Counter(a1).most_common()
num = 0
for i in range(len(a)):
    if a[i][1]%2 == 1:
        num += 1
print(num)

Submission status: Accepted

Solution code:
N=int(input())
A=[]
for i in range(N):
  A.append(int(input()))
A.sort()
# print(A)

# 想定解で解くしかない
res=0
i=0
while i<N:
  c=A[i]
  f=0
  while i<N and A[i]==c:
    f+=1
    i+=1
  res+=f%2
print(res)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(input()) for _ in range(N)]
A=sorted(A)
 
ans=0
cnt=1
tmp=A[0]
 
for i in range(1,N):
    if A[i]==tmp:
        cnt+=1
    else:
        if cnt%2!=0:
            ans+=1
        cnt=1
    tmp=A[i]
    
if cnt%2==1:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
import collections

N = int(input())
table = [int(input()) for _ in range(N)]

ans = 0
cnt = collections.Counter(table).most_common()

for i in cnt:
    if i[1] % 2 != 0:
        ans += 1

print(ans)
exit()

Submission status: Accepted

Solution code:
from collections import defaultdict
n = int(input())
a = defaultdict(int)
for _ in range(n):
    A = int(input())
    a[A] += 1
#print(a)
count = 0
for v in a.values():
    if v % 2 != 0:
        count += 1
print(count)

Submission status: Accepted

Solution code:
from collections import Counter

N=int(input())
A=[int(input()) for _ in range(N)]

c = Counter(A)

if len(c)==N:
  print(N)
  exit()
elif len(c)==N-1:
  print(N-2)
  exit()

ans = 0
for k in c.keys():
  if c[k] % 2 == 1:ans += 1
    
print(ans)

Submission status: Accepted

Solution code:
import collections
cc = collections.Counter()
for _ in range(int(raw_input())):
	v = int(raw_input())
	cc[v] += 1
	if cc[v] == 2:
		cc[v] = 0
s = 0
for k in cc:
	if cc[k] == 1:
		s +=1
print s

Submission status: Accepted

Solution code:
N=int(input())
s=set()
for i in range(N):
    A=int(input())
    if A in s:
        s.discard(A)
    else:
        s.add(A)
print(len(s))

Submission status: Accepted

Solution code:
import collections
N = int(input())
a = [int(input())for i in range(N)]

c = collections.Counter(a)
count = 0
for i in c.values():
  if i%2==1:
    count+=1
    
print(count)

Submission status: Accepted

Solution code:
from collections import defaultdict

N = int(input())

dic = defaultdict(bool)
for _ in range(N):
  a = int(input())
  dic[a] = not dic[a]

print(sum(dic.values()))

Submission status: Accepted

Solution code:
from collections import Counter
n=int(input())
L=[int(input()) for i in range(n)]
L1=Counter(L)
ans=0
for i in L1:
    if L1[i]%2!=0:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
#! /usr/bin/env python3

from fractions import gcd
# from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N = int(input())
A = [int(input()) for i in range(N)]

c = Counter(A)

ret = list(filter(lambda x: x % 2 == 1,  c.values()))

print(len(ret))

Submission status: Accepted

Solution code:
#! /usr/bin/env python3

from fractions import gcd
# from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

N = int(input())
A = [int(input()) for i in range(N)]

c = Counter(A)

ret = 0
for key, item in c.items():
    if item % 2 == 1:
        ret += 1

print(ret)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(input()) for _ in range(n)]

a.sort()
count = 0
temp = a[0]
tempcount = 1
for i in range(1,n):
    if a[i]==temp:
        tempcount += 1
    else:
        if not tempcount%2 == 0:
            count += 1
        tempcount = 1
    temp = a[i]
    #print(i,tempcount)
if tempcount%2 == 1:
    count += 1
print(count)

Submission status: Accepted

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N = int(input())
A = Counter([int(input()) for _ in range(N)])
ans = 0
for k, v in A.items():
    if v % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = {}

cnt = 0
for i in range(n):
    ai = int(input()) - 1

    if ai in a:
        cnt -= 1
        del a[ai]
    else:
        cnt += 1
        a[ai] = 1

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

dic = {}
for i in range(n):
  a = int(input())
  if not a in dic:
    dic[a] = 1
  else:
    dic[a] += 1
print(len([k for k, v in dic.items() if v % 2 != 0]))

Submission status: Accepted

Solution code:
n = int(input())
d = dict()
for _ in range(n):
    k = int(input())
    if d.get(k) == None or d.get(k) == 0:
        d[k] = 1
    else:
        d[k] = 0

print(sum(d.values()))

Submission status: Accepted

Solution code:
from typing import List


def main():
    n = int(input())
    nums = [input() for _ in range(n)]
    print(wae(n, nums))


def wae(n: int, nums: List[str]) -> int:
    s = set()

    for i in range(n):
        num = nums[i]
        if num in s:
            s.remove(num)
        else:
            s.add(num)

    return len(s)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def c(s):
    n = input()
    if n in s:
        s.remove(n)
    else:
        s.add(n)

def main():
    n = int(input())
    s = set()

    for i in range(n):
        c(s)

    print(len(s))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import collections
n=int(input())
arr=[]
for i in range(n):
  a=int(input())
  arr.append(a)
c = collections.Counter(arr)
ans=0
for j in c.values():
    if j % 2 != 0:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import collections

n=int(input())

arr=[]

for i in range(n):

    a=int(input())
    arr.append(a)

c = collections.Counter(arr)

ans=0

for j in c.values():
    if j % 2 != 0:
        ans += 1

print(ans)