def count(self, val):
<EOL>_maxes = self._maxes<EOL>if not _maxes:<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>pos_left = bisect_left(_maxes, val)<EOL>if pos_left == len(_maxes):<EOL><INDENT>return <NUM_LIT:0><EOL><DEDENT>_lists = self._lists<EOL>idx_left = bisect_left(_lists[pos_left], val)<EOL>pos_right = bisect_right(_maxes, val)<EOL>if pos_right == len(_maxes):<EOL><INDENT>return self._len - self._loc(pos_left, idx_left)<EOL><DEDENT>idx_right = bisect_right(_lists[pos_right], val)<EOL>if pos_left == pos_right:<EOL><INDENT>return idx_right - idx_left<EOL><DEDENT>right = self._loc(pos_right, idx_right)<EOL>left = self._loc(pos_left, idx_left)<EOL>return right - left<EOL>
Return the number of occurrences of *val* in the list.