A sequence of n integers is called smooth, if the absolute values of the differences between successive numbers are at most d. We call a non-smooth sequence semi-smooth, if we can change exactly one number in the sequence to make it smooth. For example, let n = 4 and d = 5. The sequence 21, 20, 18, ...