# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque

def gcd(a, b):
    """最大公約数"""
    a, b = (a, b) if a >= b else (b, a)
    if b == 0:
        return a
    return gcd(b, a % b)


def prime_factorization(x):
    """素因数分解"""
    import math
    re = []
    i = 2
    while x != 1:
        if x % i == 0:
            re.append(i)
            x //= i
        else:
            i += 1
            if i > math.sqrt(x):
                re.append(x)
                break
    return re


# from decorator import stop_watch
#
#
# @stop_watch
def solve(A, B):
    div = gcd(A, B)
    print(len(set(prime_factorization(div))) + 1)


if __name__ == '__main__':
    # S = input()
    # N = int(input())
    A, B = map(int, input().split())
    # As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    # print(prime_factorization(A))
    # print(prime_factorization(B))
    solve(A, B) def gcd(a, b):
    """最大公約数"""
    a, b = (a, b) if a >= b else (b, a)
    if b == 0:
        return a
    return gcd(b, a % b) gcd """最大公約数""" a, b = (a, b) if a >= b else (b, a) a (a, b) if a >= b else (b, a) a >= b a b (a, b) a b (b, a) b a b if b == 0:
        return a
     b == 0 b 0 return a a return gcd(b, a % b) gcd(b, a % b) gcd b a % b a b a a b b def prime_factorization(x):
    """素因数分解"""
    import math
    re = []
    i = 2
    while x != 1:
        if x % i == 0:
            re.append(i)
            x //= i
        else:
            i += 1
            if i > math.sqrt(x):
                re.append(x)
                break
    return re


# from decorator import stop_watch
#
#
# @stop_watch prime_factorization """素因数分解""" import math math re = [] re [] i = 2 i 2 while x != 1:
        if x % i == 0:
            re.append(i)
            x //= i
        else:
            i += 1
            if i > math.sqrt(x):
                re.append(x)
                break
     x != 1 x 1 if x % i == 0:
            re.append(i)
            x //= i
        else:
            i += 1
            if i > math.sqrt(x):
                re.append(x)
                break
     x % i == 0 x % i x i 0 re.append(i) re.append re append i x //= i x i i += 1 i 1 if i > math.sqrt(x):
                re.append(x)
                break
     i > math.sqrt(x) i math.sqrt(x) math.sqrt math sqrt x re.append(x) re.append re append x break return re re x x def solve(A, B):
    div = gcd(A, B)
    print(len(set(prime_factorization(div))) + 1) solve div = gcd(A, B) div gcd(A, B) gcd A B print(len(set(prime_factorization(div))) + 1) print len(set(prime_factorization(div))) + 1 len(set(prime_factorization(div))) len set(prime_factorization(div)) set prime_factorization(div) prime_factorization div 1 A A B B if __name__ == '__main__':
    # S = input()
    # N = int(input())
    A, B = map(int, input().split())
    # As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    # print(prime_factorization(A))
    # print(prime_factorization(B))
    solve(A, B) __name__ == '__main__' __name__ '__main__' A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B solve(A, B) solve A B def prime_factorization(x):
    """素因数分解"""
    import math
    re = []
    i = 2
    while x != 1:
        if x % i == 0:
            re.append(i)
            x //= i
        else:
            i += 1
            if i > math.sqrt(x):
                re.append(x)
                break
    return re


# from decorator import stop_watch
#
#
# @stop_watch def prime_factorization(x):
    """素因数分解"""
    import math
    re = []
    i = 2
    while x != 1:
        if x % i == 0:
            re.append(i)
            x //= i
        else:
            i += 1
            if i > math.sqrt(x):
                re.append(x)
                break
    return re


# from decorator import stop_watch
#
#
# @stop_watch prime_factorization B = map(int, input().split()) map(int, input().split()) B def gcd(a, b):
    """最大公約数"""
    a, b = (a, b) if a >= b else (b, a)
    if b == 0:
        return a
    return gcd(b, a % b) def gcd(a, b):
    """最大公約数"""
    a, b = (a, b) if a >= b else (b, a)
    if b == 0:
        return a
    return gcd(b, a % b) gcd def solve(A, B):
    div = gcd(A, B)
    print(len(set(prime_factorization(div))) + 1) def solve(A, B):
    div = gcd(A, B)
    print(len(set(prime_factorization(div))) + 1) solve A, B = map(int, input().split()) map(int, input().split()) A
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque

def gcd(a, b):
    """最大公約数"""
    a, b = (a, b) if a >= b else (b, a)
    if b == 0:
        return a
    return gcd(b, a % b)


def prime_factorization(x):
    """素因数分解"""
    import math
    re = []
    i = 2
    while x != 1:
        if x % i == 0:
            re.append(i)
            x //= i
        else:
            i += 1
            if i > math.sqrt(x):
                re.append(x)
                break
    return re


# from decorator import stop_watch
#
#
# @stop_watch
def solve(A, B):
    div = gcd(A, B)
    print(len(set(prime_factorization(div))) + 1)


if __name__ == '__main__':
    # S = input()
    # N = int(input())
    A, B = map(int, input().split())
    # As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    # print(prime_factorization(A))
    # print(prime_factorization(B))
    solve(A, B)
