
import java.util.List;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Collections;

/**
 * Class that uses recursion to solve ACM-NC 2004, Problem 1
 *   @author Dave Reed
 *   @version 3/25/18
 */
public class ChangeMaker1 {
    private List<Integer> coins;
    
    public ChangeMaker1(List<Integer> coins) {
        this.coins = coins;
    }
    
    public int getChange(int amount) {
        return this.getChange(amount, coins.size()-1);
    }
    
    private int getChange(int amount, int maxCoinIndex) {
        if (maxCoinIndex < 0 || amount < 0) {
            return 0;
        }
        else if (amount == 0) {			
            return 1;
        }
        else {					
            return this.getChange(amount-this.coins.get(maxCoinIndex), maxCoinIndex) +
                   this.getChange(amount, maxCoinIndex-1);
        }
    }
    
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        
	    int caseNum = 1;
        int numCoins = input.nextInt();
        
	    while (numCoins != -1) {
	        ArrayList<Integer> coins = new ArrayList<Integer>();
	        for (int i = 0; i < numCoins; i++) {
                coins.add(input.nextInt());			
	        }
	        Collections.sort(coins);

            ChangeMaker1 cm = new ChangeMaker1(coins);

	        if (caseNum > 1) {
                System.out.println();
            }
	        System.out.println("Case " + caseNum + ": " + cm.getChange(100) +
                             " combinations of coins");
            
            caseNum++;
            numCoins = input.nextInt();
        }
	    input.close();
    }
}
