def factorize(n):
    fct = set()
    b,e = 2,0
    while b*b <= n:
        while n % b == 0:
            n //= b
            e += 1
        if e > 0:
            fct.add(b)
        b,e = b+1,0
    if n > 1:
        fct.add(n)
    return fct
a,b = map(int,input().split())
print(len(factorize(a)&factorize(b))+1) def factorize(n):
    fct = set()
    b,e = 2,0
    while b*b <= n:
        while n % b == 0:
            n //= b
            e += 1
        if e > 0:
            fct.add(b)
        b,e = b+1,0
    if n > 1:
        fct.add(n)
    return fct factorize fct = set() fct set() set b,e = 2,0 b 2 e 0 while b*b <= n:
        while n % b == 0:
            n //= b
            e += 1
        if e > 0:
            fct.add(b)
        b,e = b+1,0
     b*b <= n b*b b b n while n % b == 0:
            n //= b
            e += 1
         n % b == 0 n % b n b 0 n //= b n b e += 1 e 1 if e > 0:
            fct.add(b)
         e > 0 e 0 fct.add(b) fct.add fct add b b,e = b+1,0 b b+1 b 1 e 0 if n > 1:
        fct.add(n)
     n > 1 n 1 fct.add(n) fct.add fct add n return fct fct n n a,b = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b print(len(factorize(a)&factorize(b))+1) print len(factorize(a)&factorize(b))+1 len(factorize(a)&factorize(b)) len factorize(a)&factorize(b) factorize(a) factorize a factorize(b) factorize b 1 def factorize(n):
    fct = set()
    b,e = 2,0
    while b*b <= n:
        while n % b == 0:
            n //= b
            e += 1
        if e > 0:
            fct.add(b)
        b,e = b+1,0
    if n > 1:
        fct.add(n)
    return fct def factorize(n):
    fct = set()
    b,e = 2,0
    while b*b <= n:
        while n % b == 0:
            n //= b
            e += 1
        if e > 0:
            fct.add(b)
        b,e = b+1,0
    if n > 1:
        fct.add(n)
    return fct factorize a,b = map(int,input().split()) map(int,input().split()) a b = map(int,input().split()) map(int,input().split()) b
def factorize(n):
    fct = set()
    b,e = 2,0
    while b*b <= n:
        while n % b == 0:
            n //= b
            e += 1
        if e > 0:
            fct.add(b)
        b,e = b+1,0
    if n > 1:
        fct.add(n)
    return fct
a,b = map(int,input().split())
print(len(factorize(a)&factorize(b))+1)