{
TASK: flower
LANG:PASCAL
}

var
 n, i : Byte;
 a, b : array[1..200] of Byte;
 c : char;
 d, p : array[1..4] of Byte;

const w = ['N', 'S', 'E', 'W'];

procedure sd(x : Byte; f : Byte);
Begin
 a[x] := 4;
 inc(d[f]);
end;

procedure sp(x : Byte; f : Byte);
Begin
 b[x] := f;
 inc(p[f]);
end;

function find(x : Byte): Word;
var f : Byte;
 r : Word;
Begin
 If x > n then Begin find := 1; exit; end;
 r := 0;
 {for f := 1 to 4 do if (p[f]<d[f]) then}
 if (p[1]<d[1]) {and (p[1]>p[2])} then Begin sp(x, 1); Inc(r, find(x+1)); Dec(p[1]); end;
 if (p[2]<d[2])  and (p[1]>p[2])  then Begin sp(x, 2); Inc(r, find(x+1)); Dec(p[2]); end;
 if (p[3]<d[3]) {and (p[3]>p[4])} then Begin sp(x, 3); Inc(r, find(x+1)); Dec(p[3]); end;
 if (p[4]<d[4])  and (p[3]>p[4])  then Begin sp(x, 4); Inc(r, find(x+1)); Dec(p[4]); end;
 {find(x+1);}
 find := r;
end;

Begin
 readln(n);

 fillchar(d, sizeof(d), 0);

 i := 1;
 Repeat
  Repeat read(c) Until c in w;
  Case c of
   'N' : sd(i, 1);
   'S' : sd(i, 2);
   'W' : sd(i, 3);
   'E' : sd(i, 4);
  end;
  If i=n then break;
  inc(i);
 Until false;

 If (d[1]<>d[2]) or (d[3]<>d[4]) then
 Begin
  writeln(0);
  Halt(0);
 end;

 fillchar(p, sizeof(p), 0);
 writeln(find(1)-1);
end.