#include<bits/stdc++.h>
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define pii pair<int,int>
#define fi first
#define se second
#define PB push_back
#define ll long long
#define ull unsigned long long
#define pll pair<ll,ll> 
#define y1 orzkcz
using namespace std;
int n,bi[500];
int main(){
	scanf("%d",&n);
	For(i,0,(1<<n)-1) bi[i]=bi[i/2]+(i&1);
	printf("%d\n",(1<<n)-1);
	For(i,1,(1<<n)-1){
		For(j,0,(1<<n)-1) putchar((bi[i&j]&1)?'A':'B');
		puts("");
	}
}
#include<bits/stdc++.h>
using namespace std;
vector<int>a,b;
int main(){
	int n,p,q,ans=0;
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		char c=getchar();
		while(c<'0')c=getchar();
		if(c=='0')a.push_back(i);
	}
	for(int i=1;i<=n;++i){
		char c=getchar();
		while(c<'0')c=getchar();
		if(c=='0')b.push_back(i);
	}
	if(a.size()==b.size()){
		for(int i=0;i<a.size();++i){
			if(a[i]!=b[i])++ans;
		}
		cout<<ans;
	}
	else cout<<-1;
}
