count should be length

Example refers to a count function, which does not exist. Replacing it with length works.