Given an array of positive integers where all numbers occur even number of times except one number which occurs odd number of times. Find the number. code example
Example: you are given an array of integers. your task is to print the sum of numbers that occurs for an even number of times in the array.
import collections
def fun(arr):
mp = collections.defaultdict(int)
for i in range(len(arr)):
mp[arr[i]] += 1
sum = 0
for i in mp.keys():
if (mp[i] % 2 == 0):
sum += i
return sum
n= int(input())
arr = list(map(int,input().split()))
print(fun(arr))