from typing import Union


def count_occurrences(lst: list, value: Union[bool, str, int, float]) -> int:
    """Function to count occurrences of value in a list"""
    return len([x for x in lst if x == value and type(x) == type(value)])