def sdf_count(file_obj):
    """Count the number of molecules in an SDF file.

    Counts the number of times '$$$$' occurs at the start of lines
    in the file.

    Parameters
    ----------
    file_obj : file-like object

    Returns
    -------
    int
        The number of molecules in the file.

    """
    return sum(1 for line in file_obj if line[:4] == b'$$$$')