from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
import copy
import numpy as np
import sys
INF = float('inf')
mod = 10**9+7
sys.setrecursionlimit(10 ** 6)


def lcm(a, b): return a * b / gcd(a, b)

# 1 2 3
# a, b, c = LI()


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))

# a = I()


def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS()


def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S()


def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2]


def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]]


def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def]


def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]]


def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]]


def SRL(n): return [list(S()) for i in range(n)]


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def main():
    a, b = LI()
    ans = 1
    a_div = make_divisors(a)

    for div in a_div:
        if a == 1 or b == 1:
            break
        if div == 1:
            continue
        if b % div == 0:
            ans += 1
            while b % div == 0:
                b /= div
        while a % div == 0:
            a /= div
    print(ans)


if __name__ == "__main__":
    main() from math import floor, ceil, sqrt, factorial, log, gcd from itertools import accumulate, permutations, combinations, product, combinations_with_replacement from bisect import bisect_left, bisect_right from collections import Counter, defaultdict from heapq import heappop, heappush, heappushpop import copy copy import numpy as np numpy import sys sys INF = float('inf') INF float('inf') float 'inf' mod = 10**9+7 mod 10**9+7 10**9 10 9 7 sys.setrecursionlimit(10 ** 6) sys.setrecursionlimit sys setrecursionlimit 10 ** 6 10 6 def lcm(a, b): return a * b / gcd(a, b)

# 1 2 3
# a, b, c = LI() lcm a a b b def LI(): return list(map(int, sys.stdin.buffer.readline().split()))

# a = I() LI def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS() I def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S() LS def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2] S I() for i in range(n) for i in range(n) i range(n) range n for i in range(n) I() I def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]] IR n n LI() for i in range(n) for i in range(n) i range(n) range n for i in range(n) LI() LI def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def] LIR n n S() for i in range(n) for i in range(n) i range(n) range n for i in range(n) S() S def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]] SR n n LS() for i in range(n) for i in range(n) i range(n) range n for i in range(n) LS() LS def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]] LSR n n list(S()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) list(S()) list S() S def SRL(n): return [list(S()) for i in range(n)] SRL n n def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1] make_divisors lower_divisors, upper_divisors = [], [] lower_divisors [] upper_divisors [] i = 1 i 1 while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
     i*i <= n i*i i i n if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
         n % i == 0 n % i n i 0 lower_divisors.append(i) lower_divisors.append lower_divisors append i if i != n // i:
                upper_divisors.append(n//i)
         i != n // i i n // i n i upper_divisors.append(n//i) upper_divisors.append upper_divisors append n//i n i i += 1 i 1 return lower_divisors + upper_divisors[::-1] lower_divisors + upper_divisors[::-1] lower_divisors upper_divisors[::-1] upper_divisors ::-1 -1 n n def main():
    a, b = LI()
    ans = 1
    a_div = make_divisors(a)

    for div in a_div:
        if a == 1 or b == 1:
            break
        if div == 1:
            continue
        if b % div == 0:
            ans += 1
            while b % div == 0:
                b /= div
        while a % div == 0:
            a /= div
    print(ans) main a, b = LI() a LI() LI b ans = 1 ans 1 a_div = make_divisors(a) a_div make_divisors(a) make_divisors a for div in a_div:
        if a == 1 or b == 1:
            break
        if div == 1:
            continue
        if b % div == 0:
            ans += 1
            while b % div == 0:
                b /= div
        while a % div == 0:
            a /= div
     div a_div if a == 1 or b == 1:
            break
         a == 1 or b == 1 a == 1 a 1 b == 1 b 1 break if div == 1:
            continue
         div == 1 div 1 continue if b % div == 0:
            ans += 1
            while b % div == 0:
                b /= div
         b % div == 0 b % div b div 0 ans += 1 ans 1 while b % div == 0:
                b /= div
         b % div == 0 b % div b div 0 b /= div b div while a % div == 0:
            a /= div
     a % div == 0 a % div a div 0 a /= div a div print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]] def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]] IR def lcm(a, b): return a * b / gcd(a, b)

# 1 2 3
# a, b, c = LI() def lcm(a, b): return a * b / gcd(a, b)

# 1 2 3
# a, b, c = LI() lcm def LI(): return list(map(int, sys.stdin.buffer.readline().split()))

# a = I() def LI(): return list(map(int, sys.stdin.buffer.readline().split()))

# a = I() LI mod = 10**9+7 10**9+7 mod def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S() def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S() LS def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]] def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]] SR def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1] def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1] make_divisors def SRL(n): return [list(S()) for i in range(n)] def SRL(n): return [list(S()) for i in range(n)] SRL def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2] def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2] S def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]] def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]] LSR def main():
    a, b = LI()
    ans = 1
    a_div = make_divisors(a)

    for div in a_div:
        if a == 1 or b == 1:
            break
        if div == 1:
            continue
        if b % div == 0:
            ans += 1
            while b % div == 0:
                b /= div
        while a % div == 0:
            a /= div
    print(ans) def main():
    a, b = LI()
    ans = 1
    a_div = make_divisors(a)

    for div in a_div:
        if a == 1 or b == 1:
            break
        if div == 1:
            continue
        if b % div == 0:
            ans += 1
            while b % div == 0:
                b /= div
        while a % div == 0:
            a /= div
    print(ans) main INF = float('inf') float('inf') INF def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS() def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS() I def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def] def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def] LIR
from math import floor, ceil, sqrt, factorial, log, gcd
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
import copy
import numpy as np
import sys
INF = float('inf')
mod = 10**9+7
sys.setrecursionlimit(10 ** 6)


def lcm(a, b): return a * b / gcd(a, b)

# 1 2 3
# a, b, c = LI()


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))

# a = I()


def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS()


def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S()


def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2]


def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]]


def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def]


def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]]


def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]]


def SRL(n): return [list(S()) for i in range(n)]


def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


def main():
    a, b = LI()
    ans = 1
    a_div = make_divisors(a)

    for div in a_div:
        if a == 1 or b == 1:
            break
        if div == 1:
            continue
        if b % div == 0:
            ans += 1
            while b % div == 0:
                b /= div
        while a % div == 0:
            a /= div
    print(ans)


if __name__ == "__main__":
    main()
