#!/usr/bin/env python3

import sys

input = sys.stdin.buffer.readline

def gcd(a,b):
    return a if b == 0 else gcd(b,a%b)

def lcm(a,b):
    return a*b // gcd(a,b)

def prime_factorize(n):
    pf={}
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            pf[i] = pf.get(i, 0) + 1
            n //= i
    if n > 1: pf[n] = 1
    return pf

A,B = map(int,input().split())

pf = prime_factorize(gcd(A,B))
print(len(pf) + 1) import sys sys input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline def gcd(a,b):
    return a if b == 0 else gcd(b,a%b) gcd return a if b == 0 else gcd(b,a%b) a if b == 0 else gcd(b,a%b) b == 0 b 0 a gcd(b,a%b) gcd b a%b a b a a b b def lcm(a,b):
    return a*b // gcd(a,b) lcm return a*b // gcd(a,b) a*b // gcd(a,b) a*b a b gcd(a,b) gcd a b a a b b def prime_factorize(n):
    pf={}
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            pf[i] = pf.get(i, 0) + 1
            n //= i
    if n > 1: pf[n] = 1
    return pf prime_factorize pf={} pf {} for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            pf[i] = pf.get(i, 0) + 1
            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:
            pf[i] = pf.get(i, 0) + 1
            n //= i
     n % i == 0 n % i n i 0 pf[i] = pf.get(i, 0) + 1 pf[i] pf i pf.get(i, 0) + 1 pf.get(i, 0) pf.get pf get i 0 1 n //= i n i if n > 1: pf[n] = 1
     n > 1 n 1 return pf pf n n A,B = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B pf = prime_factorize(gcd(A,B)) pf prime_factorize(gcd(A,B)) prime_factorize gcd(A,B) gcd A B print(len(pf) + 1) print len(pf) + 1 len(pf) len pf 1 def gcd(a,b):
    return a if b == 0 else gcd(b,a%b) def gcd(a,b):
    return a if b == 0 else gcd(b,a%b) gcd input = sys.stdin.buffer.readline sys.stdin.buffer.readline input def prime_factorize(n):
    pf={}
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            pf[i] = pf.get(i, 0) + 1
            n //= i
    if n > 1: pf[n] = 1
    return pf def prime_factorize(n):
    pf={}
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            pf[i] = pf.get(i, 0) + 1
            n //= i
    if n > 1: pf[n] = 1
    return pf prime_factorize B = map(int,input().split()) map(int,input().split()) B def lcm(a,b):
    return a*b // gcd(a,b) def lcm(a,b):
    return a*b // gcd(a,b) lcm A,B = map(int,input().split()) map(int,input().split()) A pf = prime_factorize(gcd(A,B)) prime_factorize(gcd(A,B)) pf
#!/usr/bin/env python3

import sys

input = sys.stdin.buffer.readline

def gcd(a,b):
    return a if b == 0 else gcd(b,a%b)

def lcm(a,b):
    return a*b // gcd(a,b)

def prime_factorize(n):
    pf={}
    for i in range(2, int(n**0.5)+1):
        while n % i == 0:
            pf[i] = pf.get(i, 0) + 1
            n //= i
    if n > 1: pf[n] = 1
    return pf

A,B = map(int,input().split())

pf = prime_factorize(gcd(A,B))
print(len(pf) + 1)