#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <cstring>
#ifdef __GNUC__
#include <ext/hash_map>
#define unordered_map __gnu_cxx::hash_map
#else
#include <unordered_map>
#endif
using namespace std;
typedef long long LL;
typedef complex<double> CMP;
class AntsMeet { public:
int countAnts(vector <int> x, vector <int> y, string direction)
{
const int N = x.size();
map< int, vector< pair<int,int> > > bye;
for(int i=0; i<N; ++i)
for(int j=i+1; j<N; ++j) {
int t;
if( meet(x[i], y[i], direction[i], x[j], y[j], direction[j], &t) )
bye[t].push_back(make_pair(i,j));
}
set<int> dead;
for(map<int, vector< pair<int,int> > >::iterator it=bye.begin(); it!=bye.end(); ++it) {
set<int> die;
vector< pair<int,int> >& events = it->second;
for(int i=0; i<events.size(); ++i) {
int a = events[i].first;
int b = events[i].second;
if( dead.count(a)==0 && dead.count(b)==0 ) {
die.insert(a);
die.insert(b);
// dead.insert(a);
// dead.insert(b);
}
}
dead.insert(die.begin(), die.end());
}
return N - dead.size();
}
bool meet(int x, int y, char d, int X, int Y, int D, int* t)
{
if( d == D )
return false;
int dx = dx_of(d);
int dy = dy_of(d);
int DX = dx_of(D);
int DY = dy_of(D);
int tx;
if( !meet(x, dx, X, DX, &tx) )
return false;
int ty;
if( !meet(y, dy, Y, DY, &ty) )
return false;
*t = (tx==-1 ? ty : tx);
return (tx==ty || tx==-1 || ty==-1);
}
bool meet(int x, int dx, int X, int DX, int* t)
{
if( x==X && dx==DX ) {
*t = -1;
return true;
} else if( dx==DX ) {
return false;
} else {
*t = (x-X)*2 / (DX-dx);
return ( *t >= 0 );
}
}
int dx_of(char d)
{
if(d=='E') return +1;
if(d=='W') return -1;
return 0;
}
int dy_of(char d)
{
if(d=='N') return +1;
if(d=='S') return -1;
return 0;
}
};
// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
{ ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
{ os << "{ ";
for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const int& Expected, const int& Received) {
bool ok = (Expected == Received);
if(ok) cerr << "PASSED" << timer() << endl; else { cerr << "FAILED" << timer() << endl;
cerr << "\to: \"" << Expected << '\"' << endl << "\tx: \"" << Received << '\"' << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END verify_case(_, AntsMeet().countAnts(x, y, direction));}
int main(){
CASE(0)
int x_[] = {0,10,20,30};
vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
int y_[] = {0,10,20,30};
vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
string direction = "NWNE";
int _ = 2;
END
CASE(1)
int x_[] = {-10,0,0,10};
vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
int y_[] = {0,-10,10,0};
vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
string direction = "NEWS";
int _ = 0;
END
CASE(2)
int x_[] = {-1,-1,-1,0,0,0,1,1,1};
vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
int y_[] = {-1,0,1,-1,0,1,-1,0,1};
vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
string direction = "ESEWNNEWW";
int _ = 4;
END
CASE(3)
int x_[] = {4,7,6,2,6,5,7,7,8,4,7,8,8,8,5,4,8,9,1,5,9,3,4,0,0,1,0,7,2,6,9,6,3,0,5,5,1,2,0,4,9,7,7,1,8,1,9,2,7,3};
vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
int y_[] = {2,3,0,6,8,4,9,0,5,0,2,4,3,8,1,5,0,7,3,7,0,9,8,1,9,4,7,8,1,1,6,6,6,2,8,5,1,9,0,1,1,1,7,0,2,5,4,7,5,3};
vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
string direction = "SSNWSWSENSWSESWEWSWSENWNNNESWSWSWWSSWEEWWNWWWNWENN" ;
int _ = 25;
END
CASE(4)
int x_[] = {478,-664,759,434,-405,513,565,-396,311,-174,56,993,251,-341,993,-112,242,129,383,513,-78,-341,-148,129,423
,493,434,-405,478,-148,929,251,56,242,929,-78,423,-664,802,251,759,383,-112,-591,-591,-248,660,660,735,493};
vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
int y_[] = {-186,98,948,795,289,-678,948,-170,-195,290,-354,-424,289,-157,-166,150,706,-678,684,-294,-234,36,36,-294,-216
,-234,427,945,265,-157,265,715,275,715,-186,337,798,-170,427,706,754,961,286,-216,798,286,961,684,-424,337};
vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
string direction = "WNSNNSSWWWEENWESNSWSWSEWWEWEWWWNWESNSSNNSNNWWWNESE";
int _ = 44;
END
CASE(5)
int x_[] = {0, 1, 0, 10, 9, 11};
vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
int y_[] = {0, 1, 2, 10, 11, 11};
vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
string direction = "NWSNES";
int _ = 0;
END
/*
CASE(6)
int x_[] = ;
vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_));
int y_[] = ;
vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_));
string direction = ;
int _ = ;
END
*/
}
// END CUT HERE