def num_consecutive_elements(arr)
count = 0
i = 0
while i < arr.length
if arr[i] == arr[i+1]
count = count + 1
end
i = i + 1
end
count
end
def num_consecutive_elements(arr)
count = 0
i = 0
while i < arr.length
if arr[i] == arr[i+1]
count = count + 1
end
i = i + 1
end
count
end