public static int 
	countAnts(int[] x, int[] y, String direction) {
		boolean[] ants = new boolean[x.length];
		
		checkIntersect(x, y, ants);
		
		char[] dir = direction.toCharArray();
		for (int j = 1; j <= 2000; j++) {
			for (int i = 0; i < x.length; ++i) {
				int dx = 0;
				int dy = 0;
				if (dir[i] == 'E') dx = 1;
				if (dir[i] == 'W') dx = -1;
				if (dir[i] == 'N') dy = 1;
				if (dir[i] == 'S') dy = -1;
				x[i] += dx;
				y[i] += dy;
			}
			checkIntersect(x, y, ants);
		}
	
		int count = 0;
		for (boolean alive: ants) if (alive) count++;
		return count;
	}