/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class CountThat
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		
		int i,count=0,pos,flag;
		char ch;
		String s="ABthatCDthatBHthatIOthatoo";
		
		
		for(i=0;i<s.length();i++)
		{
			pos=0;
			flag=0;
			ch=s.charAt(i);
			
			while(true) //while pos<"that".length()
			{
				if(ch!="that".charAt(pos))
				{
					flag=1;
					break;
				}
				pos++;
				if(pos<4) //"that".length()=4
				ch=s.charAt(i+pos);
				else
				break;
			}
			if(flag==0)
			{
				count++;
				i+="that".length()-1;
			}
		}
		System.out.println(count);
	}
}