from fractions import gcd

import numpy as np





def get_primes(n):

    ans = 1

    m = int(n**0.5) + 1

    flags = np.zeros(m + 1, dtype=bool)

    for i in range(2, m + 1):

        if flags[i]:

            continue

        if n % i == 0:

            ans += 1

        while n % i == 0:

            n //= i

        flags[i:m + 1:i] = 1

    return ans + 1 if n > 1 else ans





def solve(string):

    a, b = list(map(int, string.split()))

    g = gcd(a, b)

    return str(get_primes(g))





if __name__ == '__main__':

    print((solve(eval(input()))))

from fractions import gcd





def get_primes(n):

    ans = 1 if n % 2 else 2

    while n % 2 == 0:

        n //= 2

    for i in range(3, int(n**0.5) + 1, 2):

        if n % i == 0:

            ans += 1

        while n % i == 0:

            n //= i

    return ans + 1 if n > 1 else ans





def solve(string):

    a, b = list(map(int, string.split()))

    g = gcd(a, b)

    return str(get_primes(g))





if __name__ == '__main__':

    print((solve(eval(input()))))

from fractions import gcd
import numpy as np


def get_primes(n):
    ans = 1
    m = int(n**0.5) + 1
    flags = np.zeros(m + 1, dtype=bool)
    for i in range(2, m + 1):
        if flags[i]:
            continue
        if n % i == 0:
            ans += 1
        while n % i == 0:
            n //= i
        flags[i : m + 1 : i] = 1
    return ans + 1 if n > 1 else ans


def solve(string):
    a, b = list(map(int, string.split()))
    g = gcd(a, b)
    return str(get_primes(g))


if __name__ == "__main__":
    print((solve(eval(input()))))

from fractions import gcd


def get_primes(n):
    ans = 1 if n % 2 else 2
    while n % 2 == 0:
        n //= 2
    for i in range(3, int(n**0.5) + 1, 2):
        if n % i == 0:
            ans += 1
        while n % i == 0:
            n //= i
    return ans + 1 if n > 1 else ans


def solve(string):
    a, b = list(map(int, string.split()))
    g = gcd(a, b)
    return str(get_primes(g))


if __name__ == "__main__":
    print((solve(eval(input()))))

-import numpy as np -    ans = 1 -    m = int(n**0.5) + 1 -    flags = np.zeros(m + 1, dtype=bool) -    for i in range(2, m + 1): -        if flags[i]: -            continue +    ans = 1 if n % 2 else 2 +    while n % 2 == 0: +        n //= 2 +    for i in range(3, int(n**0.5) + 1, 2): -        flags[i : m + 1 : i] = 1