class Solution:
    def numberOfArithmeticSlices(self, A):
        """
        :type A: List[int]
        :rtype: int
        """
        diff=[0 for i in range(len(A)-1)]
        for i in range(len(A)-1):
            diff[i]=A[i+1]-A[i]
        diff_num=[]
        count=1
        for j in range(1,len(diff)):
            if diff[j]==diff[j-1]:
                count+=1
            else:
                if count>=2:
                    diff_num.append(count)
                count=1
                j+=1
        if count>=2:
            diff_num.append(count)
        ans=0
        for k in range(len(diff_num)):
            ans+=diff_num[k]*(diff_num[k]-1)/2
        return int(ans)
input=[1,3,5,7,9,10,11,12,13]
s=Solution()
print(s.numberOfArithmeticSlices(input))
