import java.util.*;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.io.*;
import java.math.BigInteger;

public class schools_sp implements Runnable {
	public static void main(String[] args) {
		new Thread(new schools_sp()).start();
	}

	@Override
	public void run() {
		try {
			br = new BufferedReader(new FileReader(FNAME + ".in"));
			out = new PrintWriter(FNAME + ".out");
			solve();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	boolean eof = false;

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	private final String FNAME = "schools";

	void solve() throws IOException {
		int n = nextInt();
		Pattern digits = Pattern.compile("\\d+");
		TreeMap<BigInteger, Integer> tm = new TreeMap<>();
		for (int i = 0; i < n; i++) {
			String s = br.readLine();
			Matcher matcher = digits.matcher(s);
			matcher.find();
			BigInteger number = new BigInteger(matcher.group());
			if (!tm.containsKey(number)) {
				tm.put(number, 1);
			} else {
				tm.put(number, tm.get(number) + 1);
			}
		}
		ArrayList<BigInteger> ans = new ArrayList<>(); 
		for (Entry<BigInteger, Integer> e : tm.entrySet()) {
			if (e.getValue() <= 5) {
				ans.add(e.getKey());
			}
		}
		out.println(ans.size());
		for (BigInteger b : ans) {
			out.println(b);
		}
	}
}