from fractions import gcd
def factorization(n):
    fac = {}
    count = 0
    while n % 2 == 0:
        n //= 2
        count += 1
    if count > 0:
        fac[2] = count
    for i in range(3, int(n ** .5) + 1, 2):
        count = 0
        while n % i == 0:
            n //= i
            count += 1
        if count > 0:
            fac[i] = count
    if n > 1:
        fac[n] = 1
    return fac

A, B = map(int, input().split())
fac = factorization(gcd(A, B))
print(len(fac) + 1) from fractions import gcd def factorization(n):
    fac = {}
    count = 0
    while n % 2 == 0:
        n //= 2
        count += 1
    if count > 0:
        fac[2] = count
    for i in range(3, int(n ** .5) + 1, 2):
        count = 0
        while n % i == 0:
            n //= i
            count += 1
        if count > 0:
            fac[i] = count
    if n > 1:
        fac[n] = 1
    return fac factorization fac = {} fac {} count = 0 count 0 while n % 2 == 0:
        n //= 2
        count += 1
     n % 2 == 0 n % 2 n 2 0 n //= 2 n 2 count += 1 count 1 if count > 0:
        fac[2] = count
     count > 0 count 0 fac[2] = count fac[2] fac 2 count for i in range(3, int(n ** .5) + 1, 2):
        count = 0
        while n % i == 0:
            n //= i
            count += 1
        if count > 0:
            fac[i] = count
     i range(3, int(n ** .5) + 1, 2) range 3 int(n ** .5) + 1 int(n ** .5) int n ** .5 n .5 1 2 count = 0 count 0 while n % i == 0:
            n //= i
            count += 1
         n % i == 0 n % i n i 0 n //= i n i count += 1 count 1 if count > 0:
            fac[i] = count
     count > 0 count 0 fac[i] = count fac[i] fac i count if n > 1:
        fac[n] = 1
     n > 1 n 1 fac[n] = 1 fac[n] fac n 1 return fac fac n n A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B fac = factorization(gcd(A, B)) fac factorization(gcd(A, B)) factorization gcd(A, B) gcd A B print(len(fac) + 1) print len(fac) + 1 len(fac) len fac 1 fac = factorization(gcd(A, B)) factorization(gcd(A, B)) fac A, B = map(int, input().split()) map(int, input().split()) A def factorization(n):
    fac = {}
    count = 0
    while n % 2 == 0:
        n //= 2
        count += 1
    if count > 0:
        fac[2] = count
    for i in range(3, int(n ** .5) + 1, 2):
        count = 0
        while n % i == 0:
            n //= i
            count += 1
        if count > 0:
            fac[i] = count
    if n > 1:
        fac[n] = 1
    return fac def factorization(n):
    fac = {}
    count = 0
    while n % 2 == 0:
        n //= 2
        count += 1
    if count > 0:
        fac[2] = count
    for i in range(3, int(n ** .5) + 1, 2):
        count = 0
        while n % i == 0:
            n //= i
            count += 1
        if count > 0:
            fac[i] = count
    if n > 1:
        fac[n] = 1
    return fac factorization B = map(int, input().split()) map(int, input().split()) B
from fractions import gcd
def factorization(n):
    fac = {}
    count = 0
    while n % 2 == 0:
        n //= 2
        count += 1
    if count > 0:
        fac[2] = count
    for i in range(3, int(n ** .5) + 1, 2):
        count = 0
        while n % i == 0:
            n //= i
            count += 1
        if count > 0:
            fac[i] = count
    if n > 1:
        fac[n] = 1
    return fac

A, B = map(int, input().split())
fac = factorization(gcd(A, B))
print(len(fac) + 1)