import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product
from heapq import heapify, heappop, heappush
from fractions import gcd

def solve():
    a, b = MI()

    g = gcd(a, b)

    def prime_factorization(n):
        res = []
        for i in range(2, int(pow(n, 0.5))+1):
            if n % i: continue
            ex = 0
            while n % i == 0:
                n = n // i
                ex += 1
            res.append((i, ex))
        if n != 1:
            res.append((n, 1))
        return res

    fact = prime_factorization(g)
    print(len(fact) + 1)

if __name__ == '__main__':
    solve() import sys sys sys.setrecursionlimit(10 ** 6) sys.setrecursionlimit sys setrecursionlimit 10 ** 6 10 6 def int1(x): return int(x) - 1 int1 x x def II(): return int(input()) II def MI(): return map(int, input().split()) MI def MI1(): return map(int1, input().split()) MI1 def LI(): return list(map(int, input().split())) LI def LI1(): return list(map(int1, input().split())) LI1 LI() for _ in range(rows_number) for _ in range(rows_number) _ range(rows_number) range rows_number for _ in range(rows_number) LI() LI def LLI(rows_number): return [LI() for _ in range(rows_number)] LLI rows_number rows_number def SI(): return input().split() SI def printlist(lst, k='\n'): print(k.join(list(map(str, lst)))) printlist lst lst k='\n' k '\n' INF = float('inf') INF float('inf') float 'inf' from math import ceil, floor, log2 from collections import deque from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product from heapq import heapify, heappop, heappush from fractions import gcd def solve():
    a, b = MI()

    g = gcd(a, b)

    def prime_factorization(n):
        res = []
        for i in range(2, int(pow(n, 0.5))+1):
            if n % i: continue
            ex = 0
            while n % i == 0:
                n = n // i
                ex += 1
            res.append((i, ex))
        if n != 1:
            res.append((n, 1))
        return res

    fact = prime_factorization(g)
    print(len(fact) + 1) solve a, b = MI() a MI() MI b g = gcd(a, b) g gcd(a, b) gcd a b def prime_factorization(n):
        res = []
        for i in range(2, int(pow(n, 0.5))+1):
            if n % i: continue
            ex = 0
            while n % i == 0:
                n = n // i
                ex += 1
            res.append((i, ex))
        if n != 1:
            res.append((n, 1))
        return res

     prime_factorization res = [] res [] for i in range(2, int(pow(n, 0.5))+1):
            if n % i: continue
            ex = 0
            while n % i == 0:
                n = n // i
                ex += 1
            res.append((i, ex))
         i range(2, int(pow(n, 0.5))+1) range 2 int(pow(n, 0.5))+1 int(pow(n, 0.5)) int pow(n, 0.5) pow n 0.5 1 if n % i: continue
             n % i n i ex = 0 ex 0 while n % i == 0:
                n = n // i
                ex += 1
             n % i == 0 n % i n i 0 n = n // i n n // i n i ex += 1 ex 1 res.append((i, ex)) res.append res append (i, ex) i ex if n != 1:
            res.append((n, 1))
         n != 1 n 1 res.append((n, 1)) res.append res append (n, 1) n 1 return res res n n fact = prime_factorization(g) fact prime_factorization(g) prime_factorization g print(len(fact) + 1) print len(fact) + 1 len(fact) len fact 1 if __name__ == '__main__':
    solve() __name__ == '__main__' __name__ '__main__' solve() solve def MI1(): return map(int1, input().split()) def MI1(): return map(int1, input().split()) MI1 def LLI(rows_number): return [LI() for _ in range(rows_number)] def LLI(rows_number): return [LI() for _ in range(rows_number)] LLI def SI(): return input().split() def SI(): return input().split() SI def printlist(lst, k='\n'): print(k.join(list(map(str, lst)))) def printlist(lst, k='\n'): print(k.join(list(map(str, lst)))) printlist def II(): return int(input()) def II(): return int(input()) II INF = float('inf') float('inf') INF def solve():
    a, b = MI()

    g = gcd(a, b)

    def prime_factorization(n):
        res = []
        for i in range(2, int(pow(n, 0.5))+1):
            if n % i: continue
            ex = 0
            while n % i == 0:
                n = n // i
                ex += 1
            res.append((i, ex))
        if n != 1:
            res.append((n, 1))
        return res

    fact = prime_factorization(g)
    print(len(fact) + 1) def solve():
    a, b = MI()

    g = gcd(a, b)

    def prime_factorization(n):
        res = []
        for i in range(2, int(pow(n, 0.5))+1):
            if n % i: continue
            ex = 0
            while n % i == 0:
                n = n // i
                ex += 1
            res.append((i, ex))
        if n != 1:
            res.append((n, 1))
        return res

    fact = prime_factorization(g)
    print(len(fact) + 1) solve def int1(x): return int(x) - 1 def int1(x): return int(x) - 1 int1 def MI(): return map(int, input().split()) def MI(): return map(int, input().split()) MI def LI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) LI def LI1(): return list(map(int1, input().split())) def LI1(): return list(map(int1, input().split())) LI1
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def SI(): return input().split()

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

from math import ceil, floor, log2
from collections import deque
from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product
from heapq import heapify, heappop, heappush
from fractions import gcd

def solve():
    a, b = MI()

    g = gcd(a, b)

    def prime_factorization(n):
        res = []
        for i in range(2, int(pow(n, 0.5))+1):
            if n % i: continue
            ex = 0
            while n % i == 0:
                n = n // i
                ex += 1
            res.append((i, ex))
        if n != 1:
            res.append((n, 1))
        return res

    fact = prime_factorization(g)
    print(len(fact) + 1)

if __name__ == '__main__':
    solve()
