---
# System prepended metadata

title: Hello

---

Array A2 contains random integers where all integers are occurring twice except one integers, which is occurring only once. Find the total number of bits needed to be flipped to convert m to s. (flip means changing 1 to 0 or 0 to 1). If m and s are equal, then print O.
Example :
A1 = {2,3,4,6,7,8}, A2 = {9,1,8,4,9,1,4}
From A1 (range of 2 to 8 is given), missing element, m = 5
From A2, all elements are occurring twice except 8, s = 8
Binary Representation of m = 5 = 0101
Binary Representation of s = 8 = 1000
Seeing from right, zeroth bit is 1 in 5 whereas it is 0 in 8, hence it needs to be flipped.
Similarly first bit is same in both but second and third bits are different, second and third bits need to be flipped. In total 3 bits need to be flipped. Hence, output is 3.
Input Format:
First line contains comma separated elements of array A1.
Second line contains comma separated elements of array A2.
Constraints:
1 <= Size of A1, A2 <= 100
1 <= A1i, A2i <= 105
Output Format:
The only line containing number of bits to be flipped to convert m to s.




Sample Test Cases
Case 1
Input:
1,2,3,5,6
4,5,6,5,4
Output:
1
singh17
pankaj_
Explanation:
Missing element from first array is 4. From second array, 6 is occurring only once.
Binary Representations of 4 and 6 are 100 and 110 respectively. Only one bit (middle bit) needs to be flipped to convert 4 to 6.
Hence, output is 1.
Case 2
Input:
6,7,8,9,11
12,16,10,10,15,16,12
sing
Output:
2
Explanation:
Missing element from first array is 10. From second array, 15 is occurring only once.
Binary Representations of 10 and 15 are 1010 and 1111 respectively. In 1010, both bits with value=0 need to be flipped to convert 10 to 15., Hence, output is 2.



Solution:


```
def count_bit_flips(A1, A2):
    start = min(A1)
    end = max(A1)
    expected_sum = (end * (end + 1)) // 2 - ((start - 1) * start) // 2
    actual_sum = sum(A1)
    m = expected_sum - actual_sum
    s = 0
    for num in A2:
        s ^= num
    xor_val = m ^ s
    return bin(xor_val).count('1')


# -------- Input Handling --------
A1 = list(map(int, input().split(',')))
A2 = list(map(int, input().split(',')))

print(count_bit_flips(A1, A2))
```