def primeFact(n):
    i = 2
    pl = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            pl.append(i)
        i += 1
    if n > 1:
        pl.append(int(n))
    return pl


a, b = map(int, input().split())
print(len(set(primeFact(a)) & set(primeFact(b))) + 1) def primeFact(n):
    i = 2
    pl = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            pl.append(i)
        i += 1
    if n > 1:
        pl.append(int(n))
    return pl primeFact i = 2 i 2 pl = [] pl [] while i * i <= n:
        while n % i == 0:
            n /= i
            pl.append(i)
        i += 1
     i * i <= n i * i i i n while n % i == 0:
            n /= i
            pl.append(i)
         n % i == 0 n % i n i 0 n /= i n i pl.append(i) pl.append pl append i i += 1 i 1 if n > 1:
        pl.append(int(n))
     n > 1 n 1 pl.append(int(n)) pl.append pl append int(n) int n return pl pl n n a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b print(len(set(primeFact(a)) & set(primeFact(b))) + 1) print len(set(primeFact(a)) & set(primeFact(b))) + 1 len(set(primeFact(a)) & set(primeFact(b))) len set(primeFact(a)) & set(primeFact(b)) set(primeFact(a)) set primeFact(a) primeFact a set(primeFact(b)) set primeFact(b) primeFact b 1 a, b = map(int, input().split()) map(int, input().split()) a b = map(int, input().split()) map(int, input().split()) b def primeFact(n):
    i = 2
    pl = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            pl.append(i)
        i += 1
    if n > 1:
        pl.append(int(n))
    return pl def primeFact(n):
    i = 2
    pl = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            pl.append(i)
        i += 1
    if n > 1:
        pl.append(int(n))
    return pl primeFact
def primeFact(n):
    i = 2
    pl = []
    while i * i <= n:
        while n % i == 0:
            n /= i
            pl.append(i)
        i += 1
    if n > 1:
        pl.append(int(n))
    return pl


a, b = map(int, input().split())
print(len(set(primeFact(a)) & set(primeFact(b))) + 1)
