
from collections import defaultdict


def prime_factor(n):
    d = defaultdict(int)
    for i in range(2, n + 1):
        if i * i > n:
            break

        while n % i == 0:
            d[i] += 1
            n //= i

    if n != 1:
        d[n] += 1

    return d


A, B = map(int, input().split())
prime_a = prime_factor(A)
prime_b = prime_factor(B)
print(len(set(prime_a) & set(prime_b)) + 1) from collections import defaultdict def prime_factor(n):
    d = defaultdict(int)
    for i in range(2, n + 1):
        if i * i > n:
            break

        while n % i == 0:
            d[i] += 1
            n //= i

    if n != 1:
        d[n] += 1

    return d prime_factor d = defaultdict(int) d defaultdict(int) defaultdict int for i in range(2, n + 1):
        if i * i > n:
            break

        while n % i == 0:
            d[i] += 1
            n //= i

     i range(2, n + 1) range 2 n + 1 n 1 if i * i > n:
            break

         i * i > n i * i i i n break while n % i == 0:
            d[i] += 1
            n //= i

     n % i == 0 n % i n i 0 d[i] += 1 d[i] d i 1 n //= i n i if n != 1:
        d[n] += 1

     n != 1 n 1 d[n] += 1 d[n] d n 1 return d d n n A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B prime_a = prime_factor(A) prime_a prime_factor(A) prime_factor A prime_b = prime_factor(B) prime_b prime_factor(B) prime_factor B print(len(set(prime_a) & set(prime_b)) + 1) print len(set(prime_a) & set(prime_b)) + 1 len(set(prime_a) & set(prime_b)) len set(prime_a) & set(prime_b) set(prime_a) set prime_a set(prime_b) set prime_b 1 B = map(int, input().split()) map(int, input().split()) B A, B = map(int, input().split()) map(int, input().split()) A prime_b = prime_factor(B) prime_factor(B) prime_b def prime_factor(n):
    d = defaultdict(int)
    for i in range(2, n + 1):
        if i * i > n:
            break

        while n % i == 0:
            d[i] += 1
            n //= i

    if n != 1:
        d[n] += 1

    return d def prime_factor(n):
    d = defaultdict(int)
    for i in range(2, n + 1):
        if i * i > n:
            break

        while n % i == 0:
            d[i] += 1
            n //= i

    if n != 1:
        d[n] += 1

    return d prime_factor prime_a = prime_factor(A) prime_factor(A) prime_a

from collections import defaultdict


def prime_factor(n):
    d = defaultdict(int)
    for i in range(2, n + 1):
        if i * i > n:
            break

        while n % i == 0:
            d[i] += 1
            n //= i

    if n != 1:
        d[n] += 1

    return d


A, B = map(int, input().split())
prime_a = prime_factor(A)
prime_b = prime_factor(B)
print(len(set(prime_a) & set(prime_b)) + 1)
