44_I. Toys
Little Masha loves arranging her toys into piles on the floor. And she also hates it when somebody touches her toys. One day Masha arranged all her n toys into several piles and then her elder brother Sasha came and gathered all the piles into one. Having seen it, Masha got very upset and started crying. Sasha still can't calm Masha down and mom is going to come home soon and punish Sasha for having made Masha crying. That's why he decides to restore the piles' arrangement. However, he doesn't remember at all the way the toys used to lie. Of course, Masha remembers it, but she can't talk yet and can only help Sasha by shouting happily when he arranges the toys in the way they used to lie. That means that Sasha will have to arrange the toys in every possible way until Masha recognizes the needed arrangement. The relative position of the piles and toys in every pile is irrelevant, that's why the two ways of arranging the toys are considered different if can be found two such toys that when arranged in the first way lie in one and the same pile and do not if arranged in the second way. Sasha is looking for the fastest way of trying all the ways because mom will come soon. With every action Sasha can take a toy from any pile and move it to any other pile (as a result a new pile may appear or the old one may disappear). Sasha wants to find the sequence of actions as a result of which all the pile arrangement variants will be tried exactly one time each. Help Sasha. As we remember, initially all the toys are located in one pile. 

Input

The first line contains an integer n (1 ≤ n ≤ 10) — the number of toys.

Output

In the first line print the number of different variants of arrangement of toys into piles. Then print all the ways of arranging toys into piles in the order in which Sasha should try them (i.e. every next way must result from the previous one through the operation described in the statement). Every way should be printed in the following format. In every pile the toys should be arranged in ascending order of the numbers. Then the piles should be sorted in ascending order of the numbers of the first toys there. Output every way on a single line. Cf. the example to specify the output data format. If the solution is not unique, output any of them.

Examples

Input

3


Output

5
{1,2,3}
{1,2},{3}
{1},{2,3}
{1},{2},{3}
{1,3},{2}
```python
def combinacoes(x):
    # Se for apenas 1 elemento retorna 1 arranjo
    if x == 1:
        return [[0]]
    else:
        # Adiciona os elementos a lista auxiliar
        aux = combinacoes(x - 1)
    pilha = []
    par = 0
    # Percorre a lista juntando os elementos nas possibilidades possíveis
    for element in aux:
        lmt = max(element) + 1
        if par == 0:
            for j in range(lmt + 1):
                pilha.append(element + [j])
        else:
            # Range invertido
            for j in range(lmt + 1)[::-1]:
                pilha.append(element + [j])
        par = par ^ 1
    return pilha


n = int(input())
# Gera as combinações de pilhas de brinquedos
possibilidades = combinacoes(n)
# Imprime a quantidade de combinações
print(len(possibilidades))
# Formata a Impressão como é pedido no problema
for item in possibilidades:
    arranjos = ''
    limit = max(item) + 1
    # Percorre os limites para descobrir em qual grupo o brinquedo pertence
    for group in range(limit):
        arranjos += '{'
        toys = ''
        for i in range(n):
            if item[i] == group:
                toys += '{0},'.format(i + 1)
        arranjos += toys[:-1]
        arranjos += '},'
    print(arranjos[:-1])

```