diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -1,7 +1,7 @@
 n = int(input())
 p = list(map(int, input().split()))
 
-if p[0] == 1:
+if p[0] == 1 and p[1] == 2:
     ans = 0
 elif p[0] < p[1]:
     ans = min(n - p[0] + 1, 2 + p[0] - 1)
