/*
#include <stdio.h>
int stack[100001]={};
int top=-1;
int pop()
{
return stack[top--];
}
void push(int x)
{
top++;
stack[top]=x;
}
int main()
{
int a,b,sum=0,i;
scanf("%d",&a);
for(i=0 ; i<=a-1 ; i++)
{
scanf("%d",&b);
if(b==0)
{
pop();
}
else if(b!=0)
{
push(b);
}
}
while(top!=-1)
{
sum=sum+pop();
}
printf("%d",sum);
return 0;
}
#include <stdio.h>
#include <string.h>
int main()
{
int a,b=0,c=0,i;
char str[50001]= {};
scanf("%s",str);
for(i=0 ; str[i]!=NULL ; i++)
{
if(str[i]==')')
{
b++;
}
else if(str[i]=='(')
{
c++;
}
if(b>c)
{
printf("bad");
return 0;
}
}
if(b==c)
{
printf("good");
}
else
{
printf("bad");
}
return 0;
}
*/
#include <stdio.h>
#include <string.h>
int stack[201]={};
int top=-1;
void pop()
{
top--;
}
void top1()
{
printf("%d",top);
}
void empty()
{
if(top=-1)
{
printf("true");
}
else
{
printf("false");
}
}
void size()
{
}
int push(int x)
{
top++;
stack[top]=x;
}
int main()
{
int a,b,i;
char str[1001]={};
scanf("%d",&a);
for(i=1 ; i<=a ; i++)
{
scanf("%s",str);
if(str[0]=='p'&&str[1]=='u')
{
scanf("%d )",&b);
push(b);
}
else if(str[0]=='p'&&str[1]=='o')
{
pop();
}
else if(str[0]=='t')
{
top1();
}
else if(str[0]=='s')
{
size();
}
else if(str[0]=='e')
{
empty();
}
}
return 0;
}