diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -24,6 +24,6 @@
 
         total = sum(nums)
         for cand in range(1, total // 2 + 1):
-            if total % cand != 0 and fn(0, -1) == 0:
+            if total % cand == 0 and fn(0, -1) == 0:
                 return total // cand - 1
         return 0
