#include "stdio.h"
#include "malloc.h"
typedef int TElemType;
typedef struct BitNode;
{TElemType data;
struct BitNode *lchild,*rchild);
}BitNode,BitTree;
BitTree CreatBitTree(void)
{BitTree bt;TElemType x;
scanf("%d",&x);
if(x==-1) bt=NULL;
else
{bt=(BitTree)malloc(sizeof(BitNode));
bt->date=x;
bt->lchild=CreatBitTree();
bt->rchild=CreatBitTree();
}return bt;
}
int n=0;
void leafcount(BitTree bt)
{if(bt!=NULL)
{if(bt->lchild==NULL && bt->rchild==NULL)
n++;
leafcount(bt->lchild);
leafcount(bt->rchild);
}
}
void main(){
BitTree bt;
bt=CreatBitTree();
leafcount(bt);
printf("%d",n);
}