procedure mdp(n) local i, j i := 0 until *n = 1 do { j := 1 every j *:= !n n := j i +:= 1 } return i end