import fractions
a,b=map(int,input().split())
g=fractions.gcd(a,b)

def prime_factor(n):
    ass = set() 
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.add(i)
            n = n//i
    if n != 1:
        ass.add(n)
    return ass

print(len(prime_factor(g))+1) import fractions fractions a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b g=fractions.gcd(a,b) g fractions.gcd(a,b) fractions.gcd fractions gcd a b def prime_factor(n):
    ass = set() 
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.add(i)
            n = n//i
    if n != 1:
        ass.add(n)
    return ass prime_factor ass = set() ass set() set for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.add(i)
            n = n//i
     i range(2,int(n**0.5)+1) range 2 int(n**0.5)+1 int(n**0.5) int n**0.5 n 0.5 1 while n % i==0:
            ass.add(i)
            n = n//i
     n % i==0 n % i n i 0 ass.add(i) ass.add ass add i n = n//i n n//i n i if n != 1:
        ass.add(n)
     n != 1 n 1 ass.add(n) ass.add ass add n return ass ass n n print(len(prime_factor(g))+1) print len(prime_factor(g))+1 len(prime_factor(g)) len prime_factor(g) prime_factor g 1 a,b=map(int,input().split()) map(int,input().split()) a def prime_factor(n):
    ass = set() 
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.add(i)
            n = n//i
    if n != 1:
        ass.add(n)
    return ass def prime_factor(n):
    ass = set() 
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.add(i)
            n = n//i
    if n != 1:
        ass.add(n)
    return ass prime_factor b=map(int,input().split()) map(int,input().split()) b g=fractions.gcd(a,b) fractions.gcd(a,b) g
import fractions
a,b=map(int,input().split())
g=fractions.gcd(a,b)

def prime_factor(n):
    ass = set() 
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.add(i)
            n = n//i
    if n != 1:
        ass.add(n)
    return ass

print(len(prime_factor(g))+1)