program salads;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var u,v,p,o:longint;
    ans:int64;

function nod(x,y:Longint):longint;
begin
   if y=0 then nod:=x else nod:=nod(y, x mod y);
end;

function c(n,k:longint):longint;
var a,b:array[1..40] of Longint;
    i,j,op:longint;
    res:int64;
begin
   fillchar(a,sizeof(a),0);
   fillchar(b,sizeof(b),0);
   for i:=1 to n do a[i]:=i;
   for j:=1 to k do b[j]:=j;
   for i:=1 to n do
   begin
      for j:=1 to k do
      begin
         op:=nod(a[i],b[j]);
         a[i]:=a[i] div op;
         b[j]:=b[j] div op;
      end;
   end;

   for j:=1 to n-k do b[j]:=j;

   for i:=1 to n do
   begin
      for j:=1 to k do
      begin
         op:=nod(a[i],b[j]);
         a[i]:=a[i] div op;
         b[j]:=b[j] div op;
      end;
   end;

   res:=1;

   for i:=1 to n do res:=res*a[i];

   c:=res;

end;


begin
  reset(input,'salads.in');
  read(u);
  for v:=1 to u do
  begin
     ans:=0;
     read(o);
     for p:=2 to o do ans:=ans+c(o,p);
     writeln(ans);
  end;

end.
