@staticmethod
def b():
    (n, *a) = map(int, sys.stdin.read().split())
    tot = 0
    for x in a:
        c = 0
        while (((x % 2) == 0) or ((x % 3) == 2)):
            x -= 1
            c += 1
        tot += c
    print(tot)
@staticmethod
def b():
    (n, *a) = map(int, sys.stdin.read().split())
    tot = 0
    for x in a:
        c = 0
        while (((x % 2) == 0) or ((x % 3) == 2)):
            x -= 1
            c += 1
        tot += c
    print(tot)