#include < stdio.h>

main()
{	int	cc ;
	long	LL, WL;
	char	state; /* 0-had a whitespace 1-didn't */
	char	flag; /* 0 word started with 'a' or 'A' */

LL=0;state=0;flag=0;WL=0;
while( (cc=getchar()) !=EOF) {
	if( cc==' ' || cc=='\n' || cc=='\t' ) {
		if(state==1 && flag==0 && WL> 2 ) {
			/* word just ended - check requirements */
			LL++;
			}
		state=0; /* current character IS whitespace*/
		}
	else {
		if( state==0) {
		/* word is just starting - set wordlength counter WL
			and flag to remember if we started with an a*/
			WL=0;
			if( cc=='a' || cc=='A' ) flag=0; else flag=1;
			}
		state=1;/* current character is NOT whitespace*/
		WL++;/*one more character in current word*/
		}	
	} /* end of while loop */
if(state==1 && flag==0 && WL> 2 ) LL++;/*word just ended because of EOF - check requirements */
printf("%6d\n",LL);
}