// Arup Guha
// 3/6/2016
// Solution to 2015 MCPC Problem H: Pyro Tubes

import java.util.*;
import java.io.*;

public class pyro {

	final public static int NUMBITS = 18;
	public static boolean[] used;
	public static int[] res;

	public static void main(String[] args) throws Exception {

		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		used = new boolean[1<<NUMBITS];

		// Read values that are on.
		int num = Integer.parseInt(stdin.readLine().trim());
		while (num != -1) {
			used[num] = true;
			num = Integer.parseInt(stdin.readLine().trim());
		}

		// Output each result.
		for (int i=0; i<used.length; i++)
			if (used[i])
				System.out.println(i+":"+solve(i));
	}

	public static int solve(int num) {

		int cnt = 0;

		// First flip one bit, see if this results in another value in our set.
		for (int i=0; i<NUMBITS; i++)
			if ((num & (1<<i)) == 0)
				if (used[(num | (1<<i))])
					cnt++;

		// Now try flipping two bits; larger bit of two must be off to increase value.
		for (int i=0; i<NUMBITS; i++)
			for (int j=i+1; j<NUMBITS; j++)
				if ((num & (1<<j)) == 0)

					// We turn bit j on and the xor flips bit i.
					if (used[((num | (1<<j))^(1<<i))])
						cnt++;

		// Ta da!!!
		return cnt;
	}
}