elif (
                        N + start - end - i - i == 2
                        and (N - end + start + 1) % 2 == 1
                    ):
                        temp.add_gate("SWAP", [i, i + 1])