
    Given a list of ride-sharing routes where each route is represented as a tuple of pickup and dropoff locations, count the number of bidirectional route pairs where there exists both a route from point A to B and a matching route from B to A. A route pair is counted only once even if multiple passengers request the same bidirectional route.
    

    
def count_bidirectional(test_list):
    """
    Given a list of ride-sharing routes where each route is represented as a tuple of pickup and dropoff locations, count the number of bidirectional route pairs where there exists both a route from point A to B and a matching route from B to A. A route pair is counted only once even if multiple passengers request the same bidirectional route.
    

    """
def count_bidirectional(test_list):
    """
    Given a list of ride-sharing routes where each route is represented as a tuple of pickup and dropoff locations, count the number of bidirectional route pairs where there exists both a route from point A to B and a matching route from B to A. A route pair is counted only once even if multiple passengers request the same bidirectional route.
    

    """
    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