
    Given historical emergency room visit data represented as time-period pairs, write a function that identifies the number of reciprocal staffing patterns between different shifts. Each pair indicates a correlated patient volume between two time periods (like morning-evening), and a pattern is considered reciprocal if both (period1, period2) and (period2, period1) exist in the dataset.
    

    
def count_bidirectional(test_list):
    """
    Given historical emergency room visit data represented as time-period pairs, write a function that identifies the number of reciprocal staffing patterns between different shifts. Each pair indicates a correlated patient volume between two time periods (like morning-evening), and a pattern is considered reciprocal if both (period1, period2) and (period2, period1) exist in the dataset.
    

    """
def count_bidirectional(test_list):
    """
    Given historical emergency room visit data represented as time-period pairs, write a function that identifies the number of reciprocal staffing patterns between different shifts. Each pair indicates a correlated patient volume between two time periods (like morning-evening), and a pattern is considered reciprocal if both (period1, period2) and (period2, period1) exist in the dataset.
    

    """
    res = 0
    for idx in range(0, len(test_list)):
        for iidx in range(idx + 1, len(test_list)):
            if test_list[iidx][0] == test_list[idx][1] and test_list[idx][1] == test_list[iidx][0]:
                res += 1
    return res