from fractions import gcd


def prime_factorize(n):
    result = []
    if n % 2 == 0:
        t = 0
        while n % 2 == 0:
            n //= 2
            t += 1
        result.append((2, t))
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i != 0:
            continue
        t = 0
        while n % i == 0:
            n //= i
            t += 1
        result.append((i, t))
        if n == 1:
            break
    if n != 1:
        result.append((n, 1))
    return result


A, B = map(int, input().split())

print(len(prime_factorize(gcd(A, B))) + 1) from fractions import gcd def prime_factorize(n):
    result = []
    if n % 2 == 0:
        t = 0
        while n % 2 == 0:
            n //= 2
            t += 1
        result.append((2, t))
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i != 0:
            continue
        t = 0
        while n % i == 0:
            n //= i
            t += 1
        result.append((i, t))
        if n == 1:
            break
    if n != 1:
        result.append((n, 1))
    return result prime_factorize result = [] result [] if n % 2 == 0:
        t = 0
        while n % 2 == 0:
            n //= 2
            t += 1
        result.append((2, t))
     n % 2 == 0 n % 2 n 2 0 t = 0 t 0 while n % 2 == 0:
            n //= 2
            t += 1
         n % 2 == 0 n % 2 n 2 0 n //= 2 n 2 t += 1 t 1 result.append((2, t)) result.append result append (2, t) 2 t for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i != 0:
            continue
        t = 0
        while n % i == 0:
            n //= i
            t += 1
        result.append((i, t))
        if n == 1:
            break
     i range(3, int(n ** 0.5) + 1, 2) range 3 int(n ** 0.5) + 1 int(n ** 0.5) int n ** 0.5 n 0.5 1 2 if n % i != 0:
            continue
         n % i != 0 n % i n i 0 continue t = 0 t 0 while n % i == 0:
            n //= i
            t += 1
         n % i == 0 n % i n i 0 n //= i n i t += 1 t 1 result.append((i, t)) result.append result append (i, t) i t if n == 1:
            break
     n == 1 n 1 break if n != 1:
        result.append((n, 1))
     n != 1 n 1 result.append((n, 1)) result.append result append (n, 1) n 1 return result result n n A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B print(len(prime_factorize(gcd(A, B))) + 1) print len(prime_factorize(gcd(A, B))) + 1 len(prime_factorize(gcd(A, B))) len prime_factorize(gcd(A, B)) prime_factorize gcd(A, B) gcd A B 1 B = map(int, input().split()) map(int, input().split()) B A, B = map(int, input().split()) map(int, input().split()) A def prime_factorize(n):
    result = []
    if n % 2 == 0:
        t = 0
        while n % 2 == 0:
            n //= 2
            t += 1
        result.append((2, t))
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i != 0:
            continue
        t = 0
        while n % i == 0:
            n //= i
            t += 1
        result.append((i, t))
        if n == 1:
            break
    if n != 1:
        result.append((n, 1))
    return result def prime_factorize(n):
    result = []
    if n % 2 == 0:
        t = 0
        while n % 2 == 0:
            n //= 2
            t += 1
        result.append((2, t))
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i != 0:
            continue
        t = 0
        while n % i == 0:
            n //= i
            t += 1
        result.append((i, t))
        if n == 1:
            break
    if n != 1:
        result.append((n, 1))
    return result prime_factorize
from fractions import gcd


def prime_factorize(n):
    result = []
    if n % 2 == 0:
        t = 0
        while n % 2 == 0:
            n //= 2
            t += 1
        result.append((2, t))
    for i in range(3, int(n ** 0.5) + 1, 2):
        if n % i != 0:
            continue
        t = 0
        while n % i == 0:
            n //= i
            t += 1
        result.append((i, t))
        if n == 1:
            break
    if n != 1:
        result.append((n, 1))
    return result


A, B = map(int, input().split())

print(len(prime_factorize(gcd(A, B))) + 1)
