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}
#include <bits/stdc++.h>
using namespace std;
struct nodo {
  int pila;
  int figli;
  int padre;
  nodo() {}
  nodo(int pila, int figli, int padre)
      : pila(pila), figli(figli), padre(padre) {}
};
vector<nodo> V[13];
void print(int x, int N) {
  vector<int> v;
  while (N > 0) {
    v.push_back(V[N][x].pila);
    x = V[N][x].padre;
    N--;
  }
  v.push_back(0);
  reverse(v.begin(), v.end());
  vector<vector<int> > pile;
  vector<int> vuoto;
  pile.push_back(vuoto);
  pile[0].push_back(0);
  for (int i = 1; i < (int)v.size(); i++) {
    if (v[i] >= (int)pile.size()) {
      assert(v[i] == (int)pile.size());
      pile.push_back(vuoto);
    }
    pile[v[i]].push_back(i);
  }
  for (int i = 0; i < (int)pile.size(); i++) {
    cout << "{";
    for (int j = 0; j < (int)pile[i].size() - 1; j++)
      cout << pile[i][j] + 1 << ",";
    cout << pile[i][pile[i].size() - 1] + 1 << "}";
    if (i != (int)pile.size() - 1) cout << ",";
  }
  cout << "\n";
}
void propaga(int x, int liv) {
  if (x % 2 == 0) {
    V[liv + 1].push_back(nodo(0, max(2, V[liv][x].figli), x));
    for (int i = V[liv][x].figli - 1; i >= 1; i--)
      V[liv + 1].push_back(nodo(i, max(i + 2, V[liv][x].figli), x));
  } else {
    for (int i = 1; i <= V[liv][x].figli - 1; i++)
      V[liv + 1].push_back(nodo(i, max(i + 2, V[liv][x].figli), x));
    V[liv + 1].push_back(nodo(0, max(2, V[liv][x].figli), x));
  }
}
int main() {
  int N;
  cin >> N;
  V[0].push_back(nodo(0, 2, -1));
  for (int i = 0; i < N - 1; i++)
    for (int j = 0; j < (int)V[i].size(); j++) propaga(j, i);
  cout << V[N - 1].size() << endl;
  for (int i = 0; i < (int)V[N - 1].size(); i++) print(i, N - 1);
  return 0;
}
