import sys
input = sys.stdin.readline
from collections import *

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

def factorize(n):
    fct = []
    
    for i in range(2, int(n**0.5)+1):
        c = 0
        
        while n%i==0:
            n //= i
            c += 1
            
        if c>0:
            fct.append((i, c))
    
    if n>1:
        fct.append((n, 1))
    
    return fct

A, B = map(int, input().split())
fct = factorize(gcd(A, B))
ans = 1+len(fct)
print(ans) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline from collections import * def gcd(a, b):
    while b:
        a, b = b, a%b
    return a gcd while b:
        a, b = b, a%b
     b a, b = b, a%b a b b a%b a b return a a a a b b def factorize(n):
    fct = []
    
    for i in range(2, int(n**0.5)+1):
        c = 0
        
        while n%i==0:
            n //= i
            c += 1
            
        if c>0:
            fct.append((i, c))
    
    if n>1:
        fct.append((n, 1))
    
    return fct factorize fct = [] fct [] for i in range(2, int(n**0.5)+1):
        c = 0
        
        while n%i==0:
            n //= i
            c += 1
            
        if c>0:
            fct.append((i, c))
    
     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 c = 0 c 0 while n%i==0:
            n //= i
            c += 1
            
         n%i==0 n%i n i 0 n //= i n i c += 1 c 1 if c>0:
            fct.append((i, c))
    
     c>0 c 0 fct.append((i, c)) fct.append fct append (i, c) i c if n>1:
        fct.append((n, 1))
    
     n>1 n 1 fct.append((n, 1)) fct.append fct append (n, 1) n 1 return fct fct n n A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B fct = factorize(gcd(A, B)) fct factorize(gcd(A, B)) factorize gcd(A, B) gcd A B ans = 1+len(fct) ans 1+len(fct) 1 len(fct) len fct print(ans) print ans def gcd(a, b):
    while b:
        a, b = b, a%b
    return a def gcd(a, b):
    while b:
        a, b = b, a%b
    return a gcd A, B = map(int, input().split()) map(int, input().split()) A def factorize(n):
    fct = []
    
    for i in range(2, int(n**0.5)+1):
        c = 0
        
        while n%i==0:
            n //= i
            c += 1
            
        if c>0:
            fct.append((i, c))
    
    if n>1:
        fct.append((n, 1))
    
    return fct def factorize(n):
    fct = []
    
    for i in range(2, int(n**0.5)+1):
        c = 0
        
        while n%i==0:
            n //= i
            c += 1
            
        if c>0:
            fct.append((i, c))
    
    if n>1:
        fct.append((n, 1))
    
    return fct factorize B = map(int, input().split()) map(int, input().split()) B fct = factorize(gcd(A, B)) factorize(gcd(A, B)) fct input = sys.stdin.readline sys.stdin.readline input ans = 1+len(fct) 1+len(fct) ans
import sys
input = sys.stdin.readline
from collections import *

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a

def factorize(n):
    fct = []
    
    for i in range(2, int(n**0.5)+1):
        c = 0
        
        while n%i==0:
            n //= i
            c += 1
            
        if c>0:
            fct.append((i, c))
    
    if n>1:
        fct.append((n, 1))
    
    return fct

A, B = map(int, input().split())
fct = factorize(gcd(A, B))
ans = 1+len(fct)
print(ans)