diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -26,8 +26,8 @@
     n = getInt()
     from math import gcd
 
-    g = 0
     a = getList()
+    g = a[-1] - a[0]
     for i in a:
         g = gcd(2 * (i - a[0]), g)
     res = a[0] % g
