Add count method for counting.