2021-11-03 21:42:21 +05:30
|
|
|
import doctest
|
2021-11-03 21:53:19 +05:30
|
|
|
from collections import Counter
|
2021-11-03 21:42:21 +05:30
|
|
|
|
|
|
|
|
2021-11-03 22:25:35 +05:30
|
|
|
def sock_merchant(ar: list[int]) -> int:
|
2021-11-03 21:42:21 +05:30
|
|
|
"""
|
2021-11-03 22:25:35 +05:30
|
|
|
>>> sock_merchant([10, 20, 20, 10, 10, 30, 50, 10, 20])
|
2021-11-03 21:42:21 +05:30
|
|
|
3
|
2021-11-03 22:25:35 +05:30
|
|
|
>>> sock_merchant([1, 1, 3, 3])
|
2021-11-03 21:42:21 +05:30
|
|
|
2
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
i = 0
|
|
|
|
occur = Counter(ar)
|
|
|
|
|
|
|
|
for x in occur.values():
|
|
|
|
i += x // 2
|
|
|
|
return i
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
2021-11-03 22:25:35 +05:30
|
|
|
array = list(map(int, input().rstrip().split()))
|
2021-11-03 21:42:21 +05:30
|
|
|
|
2021-11-03 22:25:35 +05:30
|
|
|
result = sock_merchant(array)
|
2021-11-03 21:42:21 +05:30
|
|
|
print(result)
|
|
|
|
doctest.testmod()
|