from collections import Counter

def find_needle(n,h):
    c = Counter()
    c.update(h.split())
    return c[n]

n = "portugal"
h = 'lobito programmer from portugal hello fromportugal portugal'''

print find_needle(n,h)