Raycast hit output how many

basically when you raycast with stop at first object selected it should output the distance (like it does now)
BUT when it is not selected it should output how many it hits