import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def integer_factorization(n):
    prime_count = collections.Counter()
    for i in range(2, int(math.sqrt(n)) + 2):
        while n % i == 0:
            n //= i
            prime_count[i] += 1
    if n > 1:
        prime_count[n] += 1
    return prime_count

def main():
    a, b = LI()
    d1 = integer_factorization(a)
    d2 = integer_factorization(b)
    dk1 = [k for k, v in d1.items()]
    dk2 = [k for k, v in d2.items()]
    ans = set()
    for a in dk1:
        if d2[a] == 0:
            continue
        ans.add(a)

    for b in dk2:
        if d1[b] == 0:
            continue
        ans.add(b)

    print(1 + len(ans))


main()
 import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools math string itertools fractions heapq collections re array bisect sys random time copy functools from collections import deque sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 inf = 10**20 inf 10**20 10 20 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 DR = [1, -1, 0, 0] DR [1, -1, 0, 0] 1 -1 0 0 DC = [0, 0, 1, -1] DC [0, 0, 1, -1] 0 0 1 -1 int(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x) int x def LI(): return [int(x) for x in sys.stdin.readline().split()] LI int(x)-1 for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x)-1 int(x) int x 1 def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] LI_ float(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() float(x) float x def LF(): return [float(x) for x in sys.stdin.readline().split()] LF def LS(): return sys.stdin.readline().split() LS def I(): return int(sys.stdin.readline()) I def F(): return float(sys.stdin.readline()) F def S(): return input()
      S def integer_factorization(n):
    prime_count = collections.Counter()
    for i in range(2, int(math.sqrt(n)) + 2):
        while n % i == 0:
            n //= i
            prime_count[i] += 1
    if n > 1:
        prime_count[n] += 1
    return prime_count integer_factorization prime_count = collections.Counter() prime_count collections.Counter() collections.Counter collections Counter for i in range(2, int(math.sqrt(n)) + 2):
        while n % i == 0:
            n //= i
            prime_count[i] += 1
     i range(2, int(math.sqrt(n)) + 2) range 2 int(math.sqrt(n)) + 2 int(math.sqrt(n)) int math.sqrt(n) math.sqrt math sqrt n 2 while n % i == 0:
            n //= i
            prime_count[i] += 1
     n % i == 0 n % i n i 0 n //= i n i prime_count[i] += 1 prime_count[i] prime_count i 1 if n > 1:
        prime_count[n] += 1
     n > 1 n 1 prime_count[n] += 1 prime_count[n] prime_count n 1 return prime_count prime_count n n def main():
    a, b = LI()
    d1 = integer_factorization(a)
    d2 = integer_factorization(b)
    dk1 = [k for k, v in d1.items()]
    dk2 = [k for k, v in d2.items()]
    ans = set()
    for a in dk1:
        if d2[a] == 0:
            continue
        ans.add(a)

    for b in dk2:
        if d1[b] == 0:
            continue
        ans.add(b)

    print(1 + len(ans)) main a, b = LI() a LI() LI b d1 = integer_factorization(a) d1 integer_factorization(a) integer_factorization a d2 = integer_factorization(b) d2 integer_factorization(b) integer_factorization b k for k, v in d1.items() for k, v in d1.items() k v d1.items() d1.items d1 items for k, v in d1.items() k dk1 = [k for k, v in d1.items()] dk1 [k for k, v in d1.items()] k for k, v in d2.items() for k, v in d2.items() k v d2.items() d2.items d2 items for k, v in d2.items() k dk2 = [k for k, v in d2.items()] dk2 [k for k, v in d2.items()] ans = set() ans set() set for a in dk1:
        if d2[a] == 0:
            continue
        ans.add(a)

     a dk1 if d2[a] == 0:
            continue
         d2[a] == 0 d2[a] d2 a 0 continue ans.add(a) ans.add ans add a for b in dk2:
        if d1[b] == 0:
            continue
        ans.add(b)

     b dk2 if d1[b] == 0:
            continue
         d1[b] == 0 d1[b] d1 b 0 continue ans.add(b) ans.add ans add b print(1 + len(ans)) print 1 + len(ans) 1 len(ans) len ans main() main def LF(): return [float(x) for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] LF DR = [1, -1, 0, 0] [1, -1, 0, 0] DR inf = 10**20 10**20 inf mod = 10**9 + 7 10**9 + 7 mod def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI(): return [int(x) for x in sys.stdin.readline().split()] LI def LS(): return sys.stdin.readline().split() def LS(): return sys.stdin.readline().split() LS def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] LI_ DC = [0, 0, 1, -1] [0, 0, 1, -1] DC def I(): return int(sys.stdin.readline()) def I(): return int(sys.stdin.readline()) I def S(): return input()
      def S(): return input()
      S def main():
    a, b = LI()
    d1 = integer_factorization(a)
    d2 = integer_factorization(b)
    dk1 = [k for k, v in d1.items()]
    dk2 = [k for k, v in d2.items()]
    ans = set()
    for a in dk1:
        if d2[a] == 0:
            continue
        ans.add(a)

    for b in dk2:
        if d1[b] == 0:
            continue
        ans.add(b)

    print(1 + len(ans)) def main():
    a, b = LI()
    d1 = integer_factorization(a)
    d2 = integer_factorization(b)
    dk1 = [k for k, v in d1.items()]
    dk2 = [k for k, v in d2.items()]
    ans = set()
    for a in dk1:
        if d2[a] == 0:
            continue
        ans.add(a)

    for b in dk2:
        if d1[b] == 0:
            continue
        ans.add(b)

    print(1 + len(ans)) main def integer_factorization(n):
    prime_count = collections.Counter()
    for i in range(2, int(math.sqrt(n)) + 2):
        while n % i == 0:
            n //= i
            prime_count[i] += 1
    if n > 1:
        prime_count[n] += 1
    return prime_count def integer_factorization(n):
    prime_count = collections.Counter()
    for i in range(2, int(math.sqrt(n)) + 2):
        while n % i == 0:
            n //= i
            prime_count[i] += 1
    if n > 1:
        prime_count[n] += 1
    return prime_count integer_factorization def F(): return float(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) F
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def integer_factorization(n):
    prime_count = collections.Counter()
    for i in range(2, int(math.sqrt(n)) + 2):
        while n % i == 0:
            n //= i
            prime_count[i] += 1
    if n > 1:
        prime_count[n] += 1
    return prime_count

def main():
    a, b = LI()
    d1 = integer_factorization(a)
    d2 = integer_factorization(b)
    dk1 = [k for k, v in d1.items()]
    dk2 = [k for k, v in d2.items()]
    ans = set()
    for a in dk1:
        if d2[a] == 0:
            continue
        ans.add(a)

    for b in dk2:
        if d1[b] == 0:
            continue
        ans.add(b)

    print(1 + len(ans))


main()

