#!/usr/bin/env python

import sys

lines = sys.stdin.readlines()

count = 0
for i in lines:
    #Start and end are in columns 3 and 4
    if i.startswith( "@" ):
    # filters out lines starting with t_id
        continue
    fields = i.split("\t")
    
    if fields[1] == "272" or fields[1] == "16":
        count += 1

print count