import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        while (sc.hasNext()) {
            String cur = sc.next();
            for (char c: cur.toCharArray()) {
                if (c == '.') {
                    sb.append(0);
                }
                else {
                    sb.append(1);
                }
            }
        }
        System.out.print(Integer.valueOf(sb.substring(0, 4),2));
        for (int i = 4; i < sb.length(); i += 4) {
            System.out.print(" " + Integer.valueOf(sb.substring(i, i + 4), 2));
        }
        
    }
}