from math import floor, sqrt
from collections import defaultdict
from math import gcd
def factors(n):
    d = defaultdict(int)
    for i in range(2,floor(sqrt(n))+1):
        while n % i == 0:
            n //= i
            d[i] += 1
        if n == 1:
            break
    if n != 1:
        d[n] += 1
    return d

A,B = map(int,input().split())
N = gcd(A,B)
fac = factors(N)
print(len(fac)+1) from math import floor, sqrt from collections import defaultdict from math import gcd def factors(n):
    d = defaultdict(int)
    for i in range(2,floor(sqrt(n))+1):
        while n % i == 0:
            n //= i
            d[i] += 1
        if n == 1:
            break
    if n != 1:
        d[n] += 1
    return d factors d = defaultdict(int) d defaultdict(int) defaultdict int for i in range(2,floor(sqrt(n))+1):
        while n % i == 0:
            n //= i
            d[i] += 1
        if n == 1:
            break
     i range(2,floor(sqrt(n))+1) range 2 floor(sqrt(n))+1 floor(sqrt(n)) floor sqrt(n) sqrt n 1 while n % i == 0:
            n //= i
            d[i] += 1
         n % i == 0 n % i n i 0 n //= i n i d[i] += 1 d[i] d i 1 if n == 1:
            break
     n == 1 n 1 break 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 N = gcd(A,B) N gcd(A,B) gcd A B fac = factors(N) fac factors(N) factors N print(len(fac)+1) print len(fac)+1 len(fac) len fac 1 N = gcd(A,B) gcd(A,B) N B = map(int,input().split()) map(int,input().split()) B fac = factors(N) factors(N) fac def factors(n):
    d = defaultdict(int)
    for i in range(2,floor(sqrt(n))+1):
        while n % i == 0:
            n //= i
            d[i] += 1
        if n == 1:
            break
    if n != 1:
        d[n] += 1
    return d def factors(n):
    d = defaultdict(int)
    for i in range(2,floor(sqrt(n))+1):
        while n % i == 0:
            n //= i
            d[i] += 1
        if n == 1:
            break
    if n != 1:
        d[n] += 1
    return d factors A,B = map(int,input().split()) map(int,input().split()) A
from math import floor, sqrt
from collections import defaultdict
from math import gcd
def factors(n):
    d = defaultdict(int)
    for i in range(2,floor(sqrt(n))+1):
        while n % i == 0:
            n //= i
            d[i] += 1
        if n == 1:
            break
    if n != 1:
        d[n] += 1
    return d

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