def gcd(a, b):
    while a != 0:
        a, b = b % a, a
    return b


def pf(v):
    result = 1
    for i in range(2, v + 1):
        if v < i * i:
            if v > 1:
                result += 1
            break
        if v % i == 0:
            result += 1
        while v > 1 and v % i == 0:
            v //= i
    return result


a, b = list(map(int, input().split()))
print(pf(gcd(a, b))) def gcd(a, b):
    while a != 0:
        a, b = b % a, a
    return b gcd while a != 0:
        a, b = b % a, a
     a != 0 a 0 a, b = b % a, a a b % a b a b a return b b a a b b def pf(v):
    result = 1
    for i in range(2, v + 1):
        if v < i * i:
            if v > 1:
                result += 1
            break
        if v % i == 0:
            result += 1
        while v > 1 and v % i == 0:
            v //= i
    return result pf result = 1 result 1 for i in range(2, v + 1):
        if v < i * i:
            if v > 1:
                result += 1
            break
        if v % i == 0:
            result += 1
        while v > 1 and v % i == 0:
            v //= i
     i range(2, v + 1) range 2 v + 1 v 1 if v < i * i:
            if v > 1:
                result += 1
            break
         v < i * i v i * i i i if v > 1:
                result += 1
             v > 1 v 1 result += 1 result 1 break if v % i == 0:
            result += 1
         v % i == 0 v % i v i 0 result += 1 result 1 while v > 1 and v % i == 0:
            v //= i
     v > 1 and v % i == 0 v > 1 v 1 v % i == 0 v % i v i 0 v //= i v i return result result v v a, b = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split b print(pf(gcd(a, b))) print pf(gcd(a, b)) pf gcd(a, b) gcd a b def pf(v):
    result = 1
    for i in range(2, v + 1):
        if v < i * i:
            if v > 1:
                result += 1
            break
        if v % i == 0:
            result += 1
        while v > 1 and v % i == 0:
            v //= i
    return result def pf(v):
    result = 1
    for i in range(2, v + 1):
        if v < i * i:
            if v > 1:
                result += 1
            break
        if v % i == 0:
            result += 1
        while v > 1 and v % i == 0:
            v //= i
    return result pf def gcd(a, b):
    while a != 0:
        a, b = b % a, a
    return b def gcd(a, b):
    while a != 0:
        a, b = b % a, a
    return b gcd a, b = list(map(int, input().split())) list(map(int, input().split())) a b = list(map(int, input().split())) list(map(int, input().split())) b
def gcd(a, b):
    while a != 0:
        a, b = b % a, a
    return b


def pf(v):
    result = 1
    for i in range(2, v + 1):
        if v < i * i:
            if v > 1:
                result += 1
            break
        if v % i == 0:
            result += 1
        while v > 1 and v % i == 0:
            v //= i
    return result


a, b = list(map(int, input().split()))
print(pf(gcd(a, b)))
