while true
	break if gets.to_i == 0
	a=gets.split(" ").map{|e|e.to_i}
	start = a[0]
	before = a[0]
	count = 0
	a[1..a.length-1].each_with_index{|e,i|
		i+=1
		if before == e-1
			if i == a.length-1
				print " " if count != 0
				print "#{start}-#{e}"
				count+=1
				before = e
				start = e
			else
				before = e
			end
		else
			if before == start
				start = e
				before = e
			else
				print " " if count != 0
				print "#{start}-#{a[i-1]}"
				count+=1
				start = e
				before = e
			end
		end
	}
		puts "" if count != 0
end