Automatic computation of number of shifts