function main(lines) {
    const input = lines.split('\n')
    const searchWord = input[0].toLowerCase()
    const context = input.slice(1, input.length-1) 
    const contextArray = context.join(' ').split(' ')
    
    let count = 0
    contextArray.map(function(element){
        if(element.toLowerCase() === searchWord){
            count++
        }
    })

    console.log(count)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

