#!/usr/bin/env python3

import sys
from math import gcd, sqrt
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


A, B = map(int, input().split())
g = gcd(A, B)


def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a


primes = prime_factorize(g)
print(len(primes)+1)
 import sys sys from math import gcd, sqrt read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 A, B = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B g = gcd(A, B) g gcd(A, B) gcd A B def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a prime_factorize a = set() a set() set while n % 2 == 0:
        a.add(2)
        n //= 2
     n % 2 == 0 n % 2 n 2 0 a.add(2) a.add a add 2 n //= 2 n 2 f = 3 f 3 while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
     f * f <= n f * f f f n if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
     n % f == 0 n % f n f 0 a.add(f) a.add a add f n //= f n f f += 2 f 2 if n != 1:
        a.add(n)
     n != 1 n 1 a.add(n) a.add a add n return a a n n primes = prime_factorize(g) primes prime_factorize(g) prime_factorize g print(len(primes)+1) print len(primes)+1 len(primes) len primes 1 B = map(int, input().split()) map(int, input().split()) B read = sys.stdin.buffer.read sys.stdin.buffer.read read g = gcd(A, B) gcd(A, B) g def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a prime_factorize primes = prime_factorize(g) prime_factorize(g) primes readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines A, B = map(int, input().split()) map(int, input().split()) A
#!/usr/bin/env python3

import sys
from math import gcd, sqrt
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


A, B = map(int, input().split())
g = gcd(A, B)


def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a


primes = prime_factorize(g)
print(len(primes)+1)

