program ab;
uses crt;
type
    si=0..19;
    aos=array[1..16] of string;
    aor=array[1..16] of integer;
var
   l:si;p:aos;a,f:integer;i:aor;
function st(n:si):longint;
{Namira 2 na stepen n}
         begin
              if n=1 then st:=2 else
              st:=2*st(n-1);
         end;
procedure mnc(n,k:si;p:string;var f:string);
{Premahvane na cifra ot chisloto}
          var
             r,t:string;
          begin
               r:=copy(p,1,k-1);
               if not k+1>n then begin
                  t:=copy(p,k+1,n-k);
                  f:=concat(r,t);
               end
               else f:=r;
          end;
function proverka(a:string;b:string;r:si):boolean;
{Proverka dali 2 signala pri premahvane na proizvolen simvol syvpadat}
          var
             l,p:string;
             k,f:si;
          begin
               k:=0;
               repeat
                   k:=k+1;f:=0;
                   repeat
                         f:=f+1;
                         mnc(r,k,a,l);
                         mnc(r,f,b,p);
                   until (f=r) or (l=p);
               until (k=r) or (l=p);
               proverka:= not (l=p);
          end;
procedure generirane(var a:aos);
{Generira n-cifreni signali 0-1}
          var
             i:integer;
             j,f,k,h:si;
             j1,f1,k1,h1:string[1];
          begin
             i:=0;
             for j:=0 to 1 do
                 for f:= 0 to 1 do
                     for k:= 0 to 1 do
                         for h:= 0 to 1 do begin
                             i:=i+1;
                             str(j,j1);str(f,f1);str(k,k1);str(h,h1);
                             a[i]:=concat(j1,f1,k1,h1);
                         end;
          end;
begin
     clrscr;
     readln(l);writeln(st(l));
     generirane(p);
     for a:= 1 to 16 do
         for f:= 1 to 16 do if a<>f then
         if not proverka(p[a],p[f],4) then p[a]:='2222';
     for a:= 1 to 16 do if p[a] <> '2222' then writeln(p[a]);
     readln(l);
end.