import sys

numbers = []
sys.stdout = open('schools.out', 'w')
strings = open("schools.in").read().rstrip().split('\n')
for string in strings[1:]:
    i = 0
    while string[i] not in '0123456789':
        i += 1
    j = i
    while i < len(string) and string[i] in '0123456789':
        i += 1
    numbers.append(string[j:i])
numbers.sort()
counter = 1
answer = []
numbers.append('z')
for i in range(1, len(numbers)):
    if numbers[i] == numbers[i-1]:
        counter += 1
    else:
        if counter <= 5:
            answer.append(numbers[i-1])
        counter = 1
print(len(answer), "\n".join(answer), sep="\n")