Debugged Josephus problem