import math
from collections import Counter
a, b = map(int, input().split())
x = math.gcd(a, b)

Nso = []
Nruto = math.sqrt(x)
Nruto = math.floor(Nruto)

for i in range(2, Nruto+1):
    while x % i == 0:
        x = x//i
        Nso.append(i)
    if x == 1:
        break
    Nruto = math.sqrt(x)
    Nruto = math.floor(Nruto)

Nso.append(x)
Nso.append(1)
Nso = Counter(Nso)
print(len(Nso)) import math math from collections import Counter a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b x = math.gcd(a, b) x math.gcd(a, b) math.gcd math gcd a b Nso = [] Nso [] Nruto = math.sqrt(x) Nruto math.sqrt(x) math.sqrt math sqrt x Nruto = math.floor(Nruto) Nruto math.floor(Nruto) math.floor math floor Nruto for i in range(2, Nruto+1):
    while x % i == 0:
        x = x//i
        Nso.append(i)
    if x == 1:
        break
    Nruto = math.sqrt(x)
    Nruto = math.floor(Nruto) i range(2, Nruto+1) range 2 Nruto+1 Nruto 1 while x % i == 0:
        x = x//i
        Nso.append(i)
     x % i == 0 x % i x i 0 x = x//i x x//i x i Nso.append(i) Nso.append Nso append i if x == 1:
        break
     x == 1 x 1 break Nruto = math.sqrt(x) Nruto math.sqrt(x) math.sqrt math sqrt x Nruto = math.floor(Nruto) Nruto math.floor(Nruto) math.floor math floor Nruto Nso.append(x) Nso.append Nso append x Nso.append(1) Nso.append Nso append 1 Nso = Counter(Nso) Nso Counter(Nso) Counter Nso print(len(Nso)) print len(Nso) len Nso a, b = map(int, input().split()) map(int, input().split()) a Nso = Counter(Nso) Counter(Nso) Nso x = math.gcd(a, b) math.gcd(a, b) x Nruto = math.floor(Nruto) math.floor(Nruto) Nruto Nruto = math.sqrt(x) math.sqrt(x) Nruto Nruto = math.floor(Nruto) math.floor(Nruto) Nruto x = x//i x//i x b = map(int, input().split()) map(int, input().split()) b Nso = [] [] Nso Nruto = math.sqrt(x) math.sqrt(x) Nruto
import math
from collections import Counter
a, b = map(int, input().split())
x = math.gcd(a, b)

Nso = []
Nruto = math.sqrt(x)
Nruto = math.floor(Nruto)

for i in range(2, Nruto+1):
    while x % i == 0:
        x = x//i
        Nso.append(i)
    if x == 1:
        break
    Nruto = math.sqrt(x)
    Nruto = math.floor(Nruto)

Nso.append(x)
Nso.append(1)
Nso = Counter(Nso)
print(len(Nso))
