#include<stdio.h>

int main(void){

	int a[5],b[5],i,j,hit=0,blow=0;
	
	while()
	
	for(i=0;i<4;i++)scanf("%d",&a[i]);
	for(i=0;i<4;i++)scanf("%d",&b[i]);
	
	for(i=0;i<4;i++){
		if(a[i]==b[i])hit++;
		
		for(j=0;j<4;j++){
			if(a[i]==b[j] &&a[i]!=b[i])blow++;
		}
	}
	
	printf("%d%d\n",hit,blow);
return 0;
}