#include<iostream>
using namespace std;
int main(){
    int a,b,c,d,e,f,g,h,x,y;
    cin >> a >> b >> c >> d;
    cin >> e >> f >> g >> h;
    while(1){
        if (a==e){x++;e=e+10;} 
        if (b==f){x++;f=f+10;} 
        if (c==g){x++;g=g+10;}
        if (d==h){x++;h=h+10;}
        if (e==a||e==b||e==c||e==d){y++;}
        if (f==a||f==b||f==c||f==d){y++;}
        if (g==a||g==b||g==c||g==d){y++;}
        if (h==a||h==b||h==c||h==d){y++;}
        cout << x << y << endl;
    
    
    }
return 0 ;
}
