import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
String str = sc.nextLine();
int n = Integer.valueOf(str);
String a1 = sc.nextLine();
String a2 = sc.nextLine();
String re = "";
for(int i=0; i<n; i++){
char c1 = a1.charAt(i);
char c2 = a2.charAt(i);
if(c1=='0'&& c2=='1'){
re = re+"1";
}else if(c1=='1'&& c2=='0'){
re = re+"1";
}else{
re = re+"0";
}
}
System.out.println(re);
while(re.charAt(0)=='0'){
re = re.substring(1);
}
int r=0;
int temp=1;
for(int i=re.length()-1; i>=0; i--){
if(re.charAt(i)=='1'){
r += temp;
}
temp = temp*2;
}
System.out.println(r);
}
}
}