def count_matching_pairs(arr, k):
    """
    given a unique sorted list, count the pairs of elements which sum to equal k.
    an element cannot pair with itself, and each pair counts as only one match.
    :param arr: a unique sorted list
    :param k: the target sum value
    :return: the number of elements which sum to equal k
    """
    forward_index = 0
    reverse_index = len(arr) - 1
    count = 0

    # if the array is empty or contains only one value, no matches are possible
    if reverse_index < 1:
        return 0

    while forward_index < reverse_index:
        test_sum = arr[forward_index] + arr[reverse_index]

        # we found a match, advance both the forward and reverse indexes
        if test_sum == k:
            count += 1
            forward_index += 1
            reverse_index -= 1

        # test sum is too low, we need bigger numbers.  advance forward_index
        elif test_sum < k:
            forward_index += 1

        # test sum is too high, we need smaller numbers.  advance reverse_index
        elif test_sum > k:
            reverse_index -= 1

    return count