{
TASK: flower
LANG:PASCAL
}
const max=10000000;
type situations=Record
       stn:Char;
       Nb:Longint;
       Sb:Longint;
       Wb:Longint;
       Eb:Longint;
     End;
var a,b:Array[1..max] of situations;
    n,i,j,br,p,Nt,St,Wt,Et,l:Longint;
    s:String;
    {f:Text;}
Procedure CopyAndClear;
var i:Longint;
Begin
 For i:=1 to p do
 Begin
   a[i]:=b[i];
   b[i].stn:=#0;
   b[i].Nb:=0;
   b[i].Sb:=0;
   b[i].Wb:=0;
   b[i].Eb:=0;
 End;
  l:=p;
  p:=0;
End;
Begin
  {test+}
  {Assign(f,'C:\Result.txt');
  ReWrite(f);}
  {test-}
  ReadLn(n);
  ReadLn(s);
  s:=s+' ';
 For i:=1 to n do
 Begin
   if s[1]='N' then Nt:=Nt+1;
   if s[1]='S' then St:=St+1;
   if s[1]='W' then Wt:=Wt+1;
   if s[1]='E' then Et:=Et+1;
   delete(s,1,2);
 End;
  p:=0;
 If Nt>0 then
 Begin
   p:=p+1;
   b[p].stn:='N';
   b[p].Nb:=1;
 End;
 If Wt>0 then
 Begin
   p:=p+1;
   b[p].stn:='W';
   b[p].Wb:=1;
 End;
 For j:=1 to n-1 do
 Begin
   CopyAndClear;
  For i:=1 to l do
  Begin
    If a[i].Nb<Nt then
    Begin
      p:=p+1;
      b[p].stn:='N';
      b[p].Nb:=a[i].Nb+1;
      b[p].Sb:=a[i].Sb;
      b[p].Wb:=a[i].Wb;
      b[p].Eb:=a[i].Eb;
    End;
    If (a[i].Sb<a[i].Nb)and(a[i].Sb<St) then
    Begin
      p:=p+1;
      b[p].stn:='S';
      b[p].Nb:=a[i].Nb;
      b[p].Sb:=a[i].Sb+1;
      b[p].Wb:=a[i].Wb;
      b[p].Eb:=a[i].Eb;
    End;
    If a[i].Wb<Wt then
    Begin
      p:=p+1;
      b[p].stn:='W';
      b[p].Nb:=a[i].Nb;
      b[p].Sb:=a[i].Sb;
      b[p].Wb:=a[i].Wb+1;
      b[p].Eb:=a[i].Eb;
    End;
    If (a[i].Eb<a[i].Wb)and(a[i].Eb<Et) then
    Begin
      p:=p+1;
      b[p].stn:='E';
      b[p].Nb:=a[i].Nb;
      b[p].Sb:=a[i].Sb;
      b[p].Wb:=a[i].Wb;
      b[p].Eb:=a[i].Eb+1;
    End;
  End;
 End;
  CopyAndClear;
 For i:=1 to l do
 If (a[i].Nb=Nt)and(a[i].Wb=Wt)and(a[i].Sb=St)and(a[i].Eb=Et) then
   br:=br+1;
  WriteLn(br-1);
End.