diff --git a/buggy.py b/buggy.py
--- a/buggy.py
+++ b/buggy.py
@@ -15,6 +15,6 @@
         for i in range(1, n):
             for j in range(i):
                 d = nums[i] - nums[j]
-                dp[i][d] += dp[j][d]
+                dp[i][d] += dp[j][d] + 1
             ans += sum(dp[i].values()) - i
         return ans
