from typing import Iterable
from typing import Dict
from typing import Set


def cochain_val(
        users: Iterable[str], friend_dict: Dict[str, Set[str]]) -> int:
    """ Returns the number of friends shared by each user in users.

    Args:
        users: An interable of users for which to check mutual friends
        friend_dict: The dictionary containing friend connections

    Returns:
        An integer representing the number of mutual friends shared
        by all users in users
    """

    if not users:
        return 0
    return len(set.intersection(*(friend_dict[user] for user in users)))