#include <bits/stdc++.h>
using namespace std;
struct jihe {
  int p[11];
};
struct dat {
  int C[11];
} A[11];
inline bool operator<(dat a, dat b) { return a.C[1] < b.C[1]; }
vector<jihe> ans[11];
int n;
void doit(jihe a, int i, int e) {
  jihe b;
  if (e) {
    b = a;
    b.p[++b.p[0]] = (1 << i);
    ans[i].push_back(b);
    for (int j = a.p[0]; j >= 1; j--) {
      a.p[j] |= (1 << i);
      ans[i].push_back(a);
      a.p[j] ^= (1 << i);
    }
  } else {
    for (int j = 1; j <= a.p[0]; j++) {
      a.p[j] |= (1 << i);
      ans[i].push_back(a);
      a.p[j] ^= (1 << i);
    }
    b = a;
    b.p[++b.p[0]] = (1 << i);
    ans[i].push_back(b);
  }
}
int main() {
  scanf("%d\n", &n);
  jihe a;
  a.p[a.p[0] = 1] = 2;
  ans[1].push_back(a);
  for (int i = 2; i <= n; i++) {
    int m = ans[i - 1].size();
    for (int j = 0; j < m; j++) doit(ans[i - 1][j], i, j & 1);
  }
  printf("%d\n", (int)ans[n].size());
  for (int i = 0; i < ans[n].size(); i++) {
    a = ans[n][i];
    int j, k;
    for (j = 1; j <= a.p[0]; j++) {
      A[j].C[0] = 0;
      for (k = 1; k <= n; k++)
        if (a.p[j] & (1 << k)) {
          A[j].C[0]++;
          A[j].C[A[j].C[0]] = k;
        }
    }
    sort(A + 1, A + 1 + a.p[0]);
    for (j = 1; j <= a.p[0]; j++) {
      printf("{");
      for (k = 1; k <= A[j].C[0]; k++) {
        printf("%d", A[j].C[k]);
        if (k < A[j].C[0]) printf(",");
      }
      printf("}");
      if (j < a.p[0]) printf(",");
    }
    printf("\n");
  }
  return 0;
}
