#include<bits/stdc++.h>
using namespace std;
struct node{
bool p;
int yu,huo;
};
node operator & (node x,node y){
if(x.p==0) return (node){0,x.yu+1,x.huo};
else return (node){x.p&y.p,x.yu+y.yu,x.huo+y.huo};
}
char ch;
node operator | (node x,node y){
if(x.p==1) return (node){1,x.yu,x.huo+1};
else return (node){x.p|y.p,x.yu+y.yu,x.huo+y.huo};
}
node f(){
node t=(node){0,0,0},res=(node){1,0,0},ans=(node){0,0,0};
while(cin>>ch){
if(ch=='0'||ch=='1') t=(node){ch-'0',0,0};
else if(ch=='&') res=res&t;
else if(ch=='|'){
res=res&t;
ans=ans|res;
res=(node){1,0,0};
}
else if(ch=='(') t=f();
else{
res=res&t;
ans=ans|res;
return ans;
}
}
res=res&t;
ans=ans|t;
return ans;
}
int main(){
node ans=f();
cout<<ans.p<<endl;
cout<<ans.yu<<' '<<ans.huo;
}