import collections
class Solution(object):
    def numberOfArithmeticSlices(self, A):
        """
        :type A: List[int]
        :rtype: int
        """
        res = 0
        dp = [collections.Counter() for i in range(len(A))]
        for i in range(len(A)):
            for j in range(i):
                diff=A[i]-A[j]
                dp[i][diff]+=1
                if diff not in dp[j]:
                    continue
                res+=dp[j][diff]
                dp[i][diff]+=dp[j][diff]
        return res

s=Solution()
accounts =[2, 4, 6, 8, 10]
print(s.numberOfArithmeticSlices(accounts))