def common_values(list1, list2):
    """
        Returns the common values of two sorted arrays
    """
    i, j, common, len_a, len_b = 0, 0, 0, len(list1), len(list2)
    while i < len_a and j < len_b:
        if list1[i] > list2[j]:
            j += 1
        elif list1[i] < list2[j]:
            i += 1
        else:
            common += 1
            i += 1
            j += 1
    return common