Least-Squares estimation of an unknown number of shifts in a time