Modeled and solved Josephus Problem