#include using namespace std; int main(void){ int q; cin>>q; stackst; int flag=-1,r1=0,r2=0,r3=0; while(q--){ int op; cin>>op; if(op==1){ char c; cin>>c; st.push(c); if(c=='('){ r1++; }else if(c=='|'){ if(!st.empty()&&st.top()=='|'&&flag==-1)flag=st.size()+1; r2++; }else{ r3++; } if(flag==-1){ if(r1