def METHOD_NAME(state: CollectionState, player: int) -> int:
    # Warning: This only considers items that are marked as advancement items
    diff = state.multiworld.difficulty_requirements[player]
    return min(state.item_count('Boss Heart Container', player), diff.boss_heart_container_limit) \
            + state.item_count('Sanctuary Heart Container', player) \
            + min(state.item_count('Piece of Heart', player), diff.heart_piece_limit) // 4 \
            + 3  # starting hearts