def count_extremities(node):
    """
    Counts the extremities in the subtree represented by the given node.
    :type node: Node
    """
    # Count all leaf nodes to get the extremities
    if node.is_leaf():
        return 1
    else:
        return len([c for c in node.get_children()
                    if not len(list(c.child_connections()))])