merge consecutive shifts