#n=int(input())
a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

def prime_factorize(n):
    n_origin=n+0
    primelist=[]
    a=2
    while a*a<=n_origin:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
    if n!=1:
        primelist.append([n,1])
    return primelist

import math
gcd=math.gcd(a,b)#最大公約数
primelist=prime_factorize(gcd)
print(len(primelist)+1) a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b def prime_factorize(n):
    n_origin=n+0
    primelist=[]
    a=2
    while a*a<=n_origin:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
    if n!=1:
        primelist.append([n,1])
    return primelist prime_factorize n_origin=n+0 n_origin n+0 n 0 primelist=[] primelist [] a=2 a 2 while a*a<=n_origin:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
     a*a<=n_origin a*a a a n_origin if n%a!=0:
            a+=1
            continue
         n%a!=0 n%a n a 0 a+=1 a 1 continue ex=0 ex 0 while n%a==0:
            ex+=1
            n=n//a
         n%a==0 n%a n a 0 ex+=1 ex 1 n=n//a n n//a n a primelist.append([a,ex]) primelist.append primelist append [a,ex] a ex a+=1 a 1 if n!=1:
        primelist.append([n,1])
     n!=1 n 1 primelist.append([n,1]) primelist.append primelist append [n,1] n 1 return primelist primelist n n import math math gcd=math.gcd(a,b) gcd math.gcd(a,b) math.gcd math gcd a b primelist=prime_factorize(gcd) primelist prime_factorize(gcd) prime_factorize gcd print(len(primelist)+1) print len(primelist)+1 len(primelist) len primelist 1 gcd=math.gcd(a,b) math.gcd(a,b) gcd def prime_factorize(n):
    n_origin=n+0
    primelist=[]
    a=2
    while a*a<=n_origin:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
    if n!=1:
        primelist.append([n,1])
    return primelist def prime_factorize(n):
    n_origin=n+0
    primelist=[]
    a=2
    while a*a<=n_origin:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
    if n!=1:
        primelist.append([n,1])
    return primelist prime_factorize b=map(int,input().split()) map(int,input().split()) b a,b=map(int,input().split()) map(int,input().split()) a primelist=prime_factorize(gcd) prime_factorize(gcd) primelist
#n=int(input())
a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

def prime_factorize(n):
    n_origin=n+0
    primelist=[]
    a=2
    while a*a<=n_origin:
        if n%a!=0:
            a+=1
            continue
        ex=0
        while n%a==0:
            ex+=1
            n=n//a
        primelist.append([a,ex])
        a+=1
    if n!=1:
        primelist.append([n,1])
    return primelist

import math
gcd=math.gcd(a,b)#最大公約数
primelist=prime_factorize(gcd)
print(len(primelist)+1)
