':type A: List[int]
:rtype: int'

def numberOfArithmeticSlices(self, A):

    (res, i) = (0, 0)
    while ((i + 2) < len(A)):
        start = i
        while (((i + 2) < len(A)) and ((A[(i + 2)] + A[i]) == (2 * A[(i + 1)]))):
            res += ((i - start) + 1)
            i += 1
        i += 1
    return res
