#include using namespace std; int main(){ int n,a,b,c,d; string r; cin>>n; long long isOK=pow(2,10)-1; long long temp; for(int i=0;i>a>>b>>c>>d>>r; if(r=="YES"){ temp=pow(2,a)+pow(2,b)+pow(2,c)+pow(2,d); }else{ temp=pow(2,10)-(pow(2,a)+pow(2,b)+pow(2,c)+pow(2,d)+1); } isOK=temp&isOK; } int ans=0; while(isOK%2==0){ isOK=isOK/2; ans++; } cout<