def solution():
    # A = input()
    # B = input()
    A = '00010001'
    B = '??'
    lenA = len(A)
    lenB = len(B)
    res = []
    for i in range(lenA-lenB+1):
        tmp = 0
        for j in range(lenB):
            if B[j] == '?' or B[j] == A[i:i+lenB][j]:
                tmp += 1
                if tmp == lenB:
                    res.append(A[i:i+lenB])
            else:
                break
    print(len(set(res)))

solution()