diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -1,6 +1,6 @@
 def main() -> None:
     n: int = int(input())
-    d: dict[int, int] = dict.fromkeys(range(2 * n + 1), 0)
+    d: dict[int, int] = dict.fromkeys(range(1, 2 * n + 1), 0)
     a: list[int] = list(map(int, input().split()))
     for i, ai in enumerate(a):
         d[(i + 1) * 2] = d[ai] + 1
