import java.util.*;

public class Main{
    public static void main(String[] args) throws Exception{
        Scanner in = new Scanner(System.in);
        int k = in.nextInt();
        String[] cidr = new String[k];
        for(int i = 0; i < k; i++){
            cidr[i] = in.next();
        }
        String[] temp = new String[k];
        for(int i = 0; i < k; i++){
            temp[i] = "";
        }
        for(int i = 0; i < k; i++){
            String[] arr = cidr[i].split("/");
            String[] arr2 = arr[0].split("\\.");
            for(int j = 0; j < arr2.length; j++){
                temp[i]+=String.format("%08d",Integer.parseInt(Integer.toBinaryString(Integer.parseInt(arr2[j]))));
            }
            temp[i] = temp[i].substring(0, Integer.parseInt(arr[1]));
        }
        boolean[] flag = new boolean[k];
        int count = k;
        for(int i = 0; i < k-1; i++){
            for(int j = i+1; j < k; j++){
                if(flag[i]==true){
                    break;
                }
                if(temp[i].indexOf(temp[j])==0){
                    flag[i] = true;
                    count--;
                }
                if(temp[j].indexOf(temp[i])==0){
                    flag[j] = true;
                    count--;
                }
            }
        }
        System.out.println(count);
        for(int i = 0; i < k; i++){
            if(!flag[i]){
                System.out.println(cidr[i]);
            }
        }
    }
}