#include "random.h"
#include <cassert>
#include <cstring>

using namespace std;          

int n,cnt;
char s[1000][1000];

int main(){
	
	assert(scanf("%d",&n)==1);
	for (int i = 0; i < n; i++){
		assert(scanf("%s",s[i]) == 1);
		assert((int)strlen(s[i]) == n);
	}

	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			s[i][j] = 'B' + 'W' - s[i][j];
	
	printf("%d\n",n);
	for (int i = 0; i < n; i++)
		printf("%s\n",s[i]);
	return 0;
}
