#!/usr/bin/env python3
# 1. 素因数分解して公約数を作成(A,B共に)
# 2. 

from collections import Counter # N : 素因数分解


def calc_prime_factor(N):
    prime_factor = []
    for i in range(2, int(N**0.5)+1):
        while N % i == 0:
            prime_factor.append(i)
            N /= i
    if N > 1:
        prime_factor.append(N)
    return prime_factor


A, B = [int(s) for s in input().split()]

prime_A = calc_prime_factor(A)
prime_B = calc_prime_factor(B)

print(len(list(set(Counter(prime_A).keys()) & set(Counter(prime_B).keys()))) + 1) from collections import Counter def calc_prime_factor(N):
    prime_factor = []
    for i in range(2, int(N**0.5)+1):
        while N % i == 0:
            prime_factor.append(i)
            N /= i
    if N > 1:
        prime_factor.append(N)
    return prime_factor calc_prime_factor prime_factor = [] prime_factor [] for i in range(2, int(N**0.5)+1):
        while N % i == 0:
            prime_factor.append(i)
            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:
            prime_factor.append(i)
            N /= i
     N % i == 0 N % i N i 0 prime_factor.append(i) prime_factor.append prime_factor append i N /= i N i if N > 1:
        prime_factor.append(N)
     N > 1 N 1 prime_factor.append(N) prime_factor.append prime_factor append N return prime_factor prime_factor N N int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s A, B = [int(s) for s in input().split()] A [int(s) for s in input().split()] B prime_A = calc_prime_factor(A) prime_A calc_prime_factor(A) calc_prime_factor A prime_B = calc_prime_factor(B) prime_B calc_prime_factor(B) calc_prime_factor B print(len(list(set(Counter(prime_A).keys()) & set(Counter(prime_B).keys()))) + 1) print len(list(set(Counter(prime_A).keys()) & set(Counter(prime_B).keys()))) + 1 len(list(set(Counter(prime_A).keys()) & set(Counter(prime_B).keys()))) len list(set(Counter(prime_A).keys()) & set(Counter(prime_B).keys())) list set(Counter(prime_A).keys()) & set(Counter(prime_B).keys()) set(Counter(prime_A).keys()) set Counter(prime_A).keys() (prime_A).keys (prime_A) Counter prime_A keys set(Counter(prime_B).keys()) set Counter(prime_B).keys() (prime_B).keys (prime_B) Counter prime_B keys 1 B = [int(s) for s in input().split()] [int(s) for s in input().split()] B prime_A = calc_prime_factor(A) calc_prime_factor(A) prime_A A, B = [int(s) for s in input().split()] [int(s) for s in input().split()] A def calc_prime_factor(N):
    prime_factor = []
    for i in range(2, int(N**0.5)+1):
        while N % i == 0:
            prime_factor.append(i)
            N /= i
    if N > 1:
        prime_factor.append(N)
    return prime_factor def calc_prime_factor(N):
    prime_factor = []
    for i in range(2, int(N**0.5)+1):
        while N % i == 0:
            prime_factor.append(i)
            N /= i
    if N > 1:
        prime_factor.append(N)
    return prime_factor calc_prime_factor prime_B = calc_prime_factor(B) calc_prime_factor(B) prime_B
#!/usr/bin/env python3
# 1. 素因数分解して公約数を作成(A,B共に)
# 2. 

from collections import Counter # N : 素因数分解


def calc_prime_factor(N):
    prime_factor = []
    for i in range(2, int(N**0.5)+1):
        while N % i == 0:
            prime_factor.append(i)
            N /= i
    if N > 1:
        prime_factor.append(N)
    return prime_factor


A, B = [int(s) for s in input().split()]

prime_A = calc_prime_factor(A)
prime_B = calc_prime_factor(B)

print(len(list(set(Counter(prime_A).keys()) & set(Counter(prime_B).keys()))) + 1)