diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -13,8 +13,8 @@
 if N & 1:
     for i in range(N):
         x = (p[i] - i) % N
-        change[(N // 2 - x - 1) % N] -= 1
         change[(N // 2 - x) % N] -= 1
+        change[(N // 2 - x + 1) % N] -= 1
         change[(N - x) % N] += 2
         if x < N // 2:
             diff += 1
