def prime_factorization(n):
    table = []
    for x in range(2, int(n ** 0.5) + 1):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table


A, B = map(int, input().split())
ad = set(prime_factorization(A))
bd = set(prime_factorization(B))

cnt = 0
for a in ad:
    if a in bd:
        cnt += 1
print(cnt+1) def prime_factorization(n):
    table = []
    for x in range(2, int(n ** 0.5) + 1):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table prime_factorization table = [] table [] for x in range(2, int(n ** 0.5) + 1):
        while n % x == 0:
            table.append(x)
            n //= x
     x range(2, int(n ** 0.5) + 1) range 2 int(n ** 0.5) + 1 int(n ** 0.5) int n ** 0.5 n 0.5 1 while n % x == 0:
            table.append(x)
            n //= x
     n % x == 0 n % x n x 0 table.append(x) table.append table append x n //= x n x if n > 1:
        table.append(n)
     n > 1 n 1 table.append(n) table.append table append n return table table n n A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B ad = set(prime_factorization(A)) ad set(prime_factorization(A)) set prime_factorization(A) prime_factorization A bd = set(prime_factorization(B)) bd set(prime_factorization(B)) set prime_factorization(B) prime_factorization B cnt = 0 cnt 0 for a in ad:
    if a in bd:
        cnt += 1 a ad if a in bd:
        cnt += 1 a in bd a bd cnt += 1 cnt 1 print(cnt+1) print cnt+1 cnt 1 bd = set(prime_factorization(B)) set(prime_factorization(B)) bd cnt += 1 1 cnt ad = set(prime_factorization(A)) set(prime_factorization(A)) ad cnt = 0 0 cnt def prime_factorization(n):
    table = []
    for x in range(2, int(n ** 0.5) + 1):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table def prime_factorization(n):
    table = []
    for x in range(2, int(n ** 0.5) + 1):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table prime_factorization A, B = map(int, input().split()) map(int, input().split()) A B = map(int, input().split()) map(int, input().split()) B
def prime_factorization(n):
    table = []
    for x in range(2, int(n ** 0.5) + 1):
        while n % x == 0:
            table.append(x)
            n //= x
    if n > 1:
        table.append(n)
    return table


A, B = map(int, input().split())
ad = set(prime_factorization(A))
bd = set(prime_factorization(B))

cnt = 0
for a in ad:
    if a in bd:
        cnt += 1
print(cnt+1)
