import math
a, b = map(int, input().split())

def is_prime(num):
    if num == 2:
        return True
    elif num <  3 or num % 2 == 0:
        return False
    for i in range(3, int(math.sqrt(num)) + 1, 2):
        if num % i == 0:
            return False
    return True

if b > a:
    a, b = b, a
c = []
for i in range(1, int(math.sqrt(b))+1):
    if b%i == 0:
        k = b//i
        if a%k == 0:
            if is_prime(k):
                c.append(k)
        if a%i == 0:
            if is_prime(i):
                c.append(i)
print(len(set(c))+1) import math math a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b def is_prime(num):
    if num == 2:
        return True
    elif num <  3 or num % 2 == 0:
        return False
    for i in range(3, int(math.sqrt(num)) + 1, 2):
        if num % i == 0:
            return False
    return True is_prime if num == 2:
        return True
    elif num <  3 or num % 2 == 0:
        return False
     num == 2 num 2 return True True elif num <  3 or num % 2 == 0:
        return False
     num <  3 or num % 2 == 0 num <  3 num 3 num % 2 == 0 num % 2 num 2 0 return False False for i in range(3, int(math.sqrt(num)) + 1, 2):
        if num % i == 0:
            return False
     i range(3, int(math.sqrt(num)) + 1, 2) range 3 int(math.sqrt(num)) + 1 int(math.sqrt(num)) int math.sqrt(num) math.sqrt math sqrt num 1 2 if num % i == 0:
            return False
     num % i == 0 num % i num i 0 return False False return True True num num if b > a:
    a, b = b, a b > a b a a, b = b, a a b b a c = [] c [] for i in range(1, int(math.sqrt(b))+1):
    if b%i == 0:
        k = b//i
        if a%k == 0:
            if is_prime(k):
                c.append(k)
        if a%i == 0:
            if is_prime(i):
                c.append(i) i range(1, int(math.sqrt(b))+1) range 1 int(math.sqrt(b))+1 int(math.sqrt(b)) int math.sqrt(b) math.sqrt math sqrt b 1 if b%i == 0:
        k = b//i
        if a%k == 0:
            if is_prime(k):
                c.append(k)
        if a%i == 0:
            if is_prime(i):
                c.append(i) b%i == 0 b%i b i 0 k = b//i k b//i b i if a%k == 0:
            if is_prime(k):
                c.append(k)
         a%k == 0 a%k a k 0 if is_prime(k):
                c.append(k)
         is_prime(k) is_prime k c.append(k) c.append c append k if a%i == 0:
            if is_prime(i):
                c.append(i) a%i == 0 a%i a i 0 if is_prime(i):
                c.append(i) is_prime(i) is_prime i c.append(i) c.append c append i print(len(set(c))+1) print len(set(c))+1 len(set(c)) len set(c) set c 1 def is_prime(num):
    if num == 2:
        return True
    elif num <  3 or num % 2 == 0:
        return False
    for i in range(3, int(math.sqrt(num)) + 1, 2):
        if num % i == 0:
            return False
    return True def is_prime(num):
    if num == 2:
        return True
    elif num <  3 or num % 2 == 0:
        return False
    for i in range(3, int(math.sqrt(num)) + 1, 2):
        if num % i == 0:
            return False
    return True is_prime b = b, a a b b = map(int, input().split()) map(int, input().split()) b c = [] [] c a, b = map(int, input().split()) map(int, input().split()) a k = b//i b//i k a, b = b, a b a
import math
a, b = map(int, input().split())

def is_prime(num):
    if num == 2:
        return True
    elif num <  3 or num % 2 == 0:
        return False
    for i in range(3, int(math.sqrt(num)) + 1, 2):
        if num % i == 0:
            return False
    return True

if b > a:
    a, b = b, a
c = []
for i in range(1, int(math.sqrt(b))+1):
    if b%i == 0:
        k = b//i
        if a%k == 0:
            if is_prime(k):
                c.append(k)
        if a%i == 0:
            if is_prime(i):
                c.append(i)
print(len(set(c))+1)