def sockMerchant(n, ar):
    # Write your code here
    d = dict()
    
    for s in ar:
        if d.get(s) is None:
            d[s] = 1
        else:
            d[s] += 1
        
    cnt = 0
    for _, v in d.items():
        cnt += v // 2
            
    return cnt

 

def bonAppetit(bill, k, b):
    # Write your code here
    actual = (sum(bill) - bill[k]) // 2
    
    result = b - actual
    
    if result > 0:
        print(result)
    else:
        print('Bon Appetit')
def dayOfProgrammer(year):
    # Write your code here
    if year == 1918:
        return '26.09.1918'
    
    check = False
    # Julian
    if ((year <= 1917) and (year % 4 == 0)):
        check = True
    # Gregorian
    elif (year % 400 == 0) or ((year % 4 == 0) and (year % 100 != 0)):
        check = True
       
    tday = 244 if check else 243
    
    return '{:02d}.09.{:04d}'.format(256 - tday, year)

 

def divisibleSumPairs(n, k, ar):
    # Write your code here
    
    # i < j
    cnt = 0
    for head in range(len(ar)):
        tail = head + 1
        while tail < n:
            if (ar[head] + ar[tail]) % k == 0:
                cnt += 1
                
            tail += 1
            
    return cnt
def birthday(s, d, m):
    # Write your code here
    cnt = 0
    for i in range(len(s) - m + 1):
        subset = sum(s[i:i + m])
        if subset == d:
            cnt += 1
            
    return cnt