// Arup Guha
// 4/7/2022
// Solution to 2017 NAQ Problem: Canonical Coins
// To illustrate DP algorithm for fewest # of coins
// 4/12/2022 - Rewrote part with TreeSet to sweep instead.

import java.util.*;

public class coins2 {

	public static void main(String[] args) {
	
		// Read in all the coins.
		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();
		int[] den = new int[n];
		
		// Read in denominations and store in a set.
		for (int i=0; i<n; i++) 
			den[i] = stdin.nextInt();
		
		// All 1 cent coins for initialization.
		int max = den[n-1]+den[n-2];
		int[] dp = new int[max+1];
		for (int i=0; i<dp.length; i++)
			dp[i] = i;
		
		// i represents the # of cents I am giving change for.
		for (int i=2; i<dp.length; i++) {
			
			// j is the coin I am thinking of giving.
			for (int j=0; j<n; j++) {
			
				// We can't give it.
				if (den[j] > i) break;
				
				dp[i] = Math.min(dp[i], dp[i-den[j]] + 1);
			}
		}
		
		boolean flag = true;
		int[] greedy = new int[max+1];
		greedy[1] = 1;
		int denI = 0;
		
		// Now we do the greedy algorithm.
		for (int i=2; i<greedy.length; i++) {
			
			// Update to largest coin we can give.
			while (denI+1<den.length && den[denI+1]<=i) denI++;
		
			// Greedy will always give this coin.
			greedy[i] = greedy[i-den[denI]] + 1;
			
			// Just go ahead and check this now...
			if (greedy[i] != dp[i]) flag = false;
		}
		
		// What we are supposed to print.
		if (flag) System.out.println("canonical");
		else		System.out.println("non-canonical");
	}
}