#include int v,c;main(){for(;~scanf("%s",&c);)c&2?v++:printf("%d\n",--v);}