import sys
import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def factorization(num):
    prime = []
    n = num
    p = 2
    while p * p <= num:
        if n % p == 0:
            cnt = 0
            while n % p == 0:
                cnt += 1
                n //= p
            prime.append((p, cnt))
        p += 1
    if n != 1:
        prime.append((n, 1))
    if not prime:
        prime.append((num, 1))
    return prime

def Main():
    a, b = read_ints()
    g = math.gcd(a, b)
    if g == 1:
        print(1)
        exit()
    prime = factorization(g)
    print(len(prime)+1)

if __name__ == '__main__':
    Main() import sys sys import math math MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 INF = 10 ** 9 INF 10 ** 9 10 9 PI = 3.14159265358979323846 PI 3.14159265358979323846 def read_str():      return sys.stdin.readline().strip() read_str def read_int():      return int(sys.stdin.readline().strip()) read_int def read_ints():     return map(int, sys.stdin.readline().strip().split()) read_ints def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split()) read_ints2 x x def read_str_list(): return list(sys.stdin.readline().strip().split()) read_str_list def read_int_list(): return list(map(int, sys.stdin.readline().strip().split())) read_int_list def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b) GCD a: int a b: int b def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b) LCM a: int a b: int b def factorization(num):
    prime = []
    n = num
    p = 2
    while p * p <= num:
        if n % p == 0:
            cnt = 0
            while n % p == 0:
                cnt += 1
                n //= p
            prime.append((p, cnt))
        p += 1
    if n != 1:
        prime.append((n, 1))
    if not prime:
        prime.append((num, 1))
    return prime factorization prime = [] prime [] n = num n num p = 2 p 2 while p * p <= num:
        if n % p == 0:
            cnt = 0
            while n % p == 0:
                cnt += 1
                n //= p
            prime.append((p, cnt))
        p += 1
     p * p <= num p * p p p num if n % p == 0:
            cnt = 0
            while n % p == 0:
                cnt += 1
                n //= p
            prime.append((p, cnt))
         n % p == 0 n % p n p 0 cnt = 0 cnt 0 while n % p == 0:
                cnt += 1
                n //= p
             n % p == 0 n % p n p 0 cnt += 1 cnt 1 n //= p n p prime.append((p, cnt)) prime.append prime append (p, cnt) p cnt p += 1 p 1 if n != 1:
        prime.append((n, 1))
     n != 1 n 1 prime.append((n, 1)) prime.append prime append (n, 1) n 1 if not prime:
        prime.append((num, 1))
     not prime prime prime.append((num, 1)) prime.append prime append (num, 1) num 1 return prime prime num num def Main():
    a, b = read_ints()
    g = math.gcd(a, b)
    if g == 1:
        print(1)
        exit()
    prime = factorization(g)
    print(len(prime)+1) Main a, b = read_ints() a read_ints() read_ints b g = math.gcd(a, b) g math.gcd(a, b) math.gcd math gcd a b if g == 1:
        print(1)
        exit()
     g == 1 g 1 print(1) print 1 exit() exit prime = factorization(g) prime factorization(g) factorization g print(len(prime)+1) print len(prime)+1 len(prime) len prime 1 if __name__ == '__main__':
    Main() __name__ == '__main__' __name__ '__main__' Main() Main def read_int():      return int(sys.stdin.readline().strip()) def read_int():      return int(sys.stdin.readline().strip()) read_int def Main():
    a, b = read_ints()
    g = math.gcd(a, b)
    if g == 1:
        print(1)
        exit()
    prime = factorization(g)
    print(len(prime)+1) def Main():
    a, b = read_ints()
    g = math.gcd(a, b)
    if g == 1:
        print(1)
        exit()
    prime = factorization(g)
    print(len(prime)+1) Main def read_ints():     return map(int, sys.stdin.readline().strip().split()) def read_ints():     return map(int, sys.stdin.readline().strip().split()) read_ints INF = 10 ** 9 10 ** 9 INF def factorization(num):
    prime = []
    n = num
    p = 2
    while p * p <= num:
        if n % p == 0:
            cnt = 0
            while n % p == 0:
                cnt += 1
                n //= p
            prime.append((p, cnt))
        p += 1
    if n != 1:
        prime.append((n, 1))
    if not prime:
        prime.append((num, 1))
    return prime def factorization(num):
    prime = []
    n = num
    p = 2
    while p * p <= num:
        if n % p == 0:
            cnt = 0
            while n % p == 0:
                cnt += 1
                n //= p
            prime.append((p, cnt))
        p += 1
    if n != 1:
        prime.append((n, 1))
    if not prime:
        prime.append((num, 1))
    return prime factorization def read_str():      return sys.stdin.readline().strip() def read_str():      return sys.stdin.readline().strip() read_str def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b) def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b) GCD MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD PI = 3.14159265358979323846 3.14159265358979323846 PI def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split()) def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split()) read_ints2 def read_str_list(): return list(sys.stdin.readline().strip().split()) def read_str_list(): return list(sys.stdin.readline().strip().split()) read_str_list def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b) def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b) LCM def read_int_list(): return list(map(int, sys.stdin.readline().strip().split())) def read_int_list(): return list(map(int, sys.stdin.readline().strip().split())) read_int_list
import sys
import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def factorization(num):
    prime = []
    n = num
    p = 2
    while p * p <= num:
        if n % p == 0:
            cnt = 0
            while n % p == 0:
                cnt += 1
                n //= p
            prime.append((p, cnt))
        p += 1
    if n != 1:
        prime.append((n, 1))
    if not prime:
        prime.append((num, 1))
    return prime

def Main():
    a, b = read_ints()
    g = math.gcd(a, b)
    if g == 1:
        print(1)
        exit()
    prime = factorization(g)
    print(len(prime)+1)

if __name__ == '__main__':
    Main()