import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B = map(int, readline().split())

MAX = max(A, B)

i = 2
setA = set()
setB = set()
while i ** 2 <= A:
    if A % i == 0:
        while A % i == 0:
            A //= i
        setA.add(i)
    i += 1
if A > 1:
    setA.add(A)
i = 2
while i ** 2 <= B:
    if B % i == 0:
        while B % i == 0:
            B //= i
        setB.add(i)
    i += 1
if B > 1:
    setB.add(B)

print(len(setA & setB) + 1)
 import sys sys import itertools itertools import time time import math math sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 from collections import defaultdict 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 A, B = map(int, readline().split()) A map(int, readline().split()) map int readline().split() ().split () readline split B MAX = max(A, B) MAX max(A, B) max A B i = 2 i 2 setA = set() setA set() set setB = set() setB set() set while i ** 2 <= A:
    if A % i == 0:
        while A % i == 0:
            A //= i
        setA.add(i)
    i += 1 i ** 2 <= A i ** 2 i 2 A if A % i == 0:
        while A % i == 0:
            A //= i
        setA.add(i)
     A % i == 0 A % i A i 0 while A % i == 0:
            A //= i
         A % i == 0 A % i A i 0 A //= i A i setA.add(i) setA.add setA add i i += 1 i 1 if A > 1:
    setA.add(A) A > 1 A 1 setA.add(A) setA.add setA add A i = 2 i 2 while i ** 2 <= B:
    if B % i == 0:
        while B % i == 0:
            B //= i
        setB.add(i)
    i += 1 i ** 2 <= B i ** 2 i 2 B if B % i == 0:
        while B % i == 0:
            B //= i
        setB.add(i)
     B % i == 0 B % i B i 0 while B % i == 0:
            B //= i
         B % i == 0 B % i B i 0 B //= i B i setB.add(i) setB.add setB add i i += 1 i 1 if B > 1:
    setB.add(B) B > 1 B 1 setB.add(B) setB.add setB add B print(len(setA & setB) + 1) print len(setA & setB) + 1 len(setA & setB) len setA & setB setA setB 1 i += 1 1 i readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline MAX = max(A, B) max(A, B) MAX i += 1 1 i A, B = map(int, readline().split()) map(int, readline().split()) A setB = set() set() setB B = map(int, readline().split()) map(int, readline().split()) B i = 2 2 i read = sys.stdin.buffer.read sys.stdin.buffer.read read A //= i i A i = 2 2 i B //= i i B setA = set() set() setA
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B = map(int, readline().split())

MAX = max(A, B)

i = 2
setA = set()
setB = set()
while i ** 2 <= A:
    if A % i == 0:
        while A % i == 0:
            A //= i
        setA.add(i)
    i += 1
if A > 1:
    setA.add(A)
i = 2
while i ** 2 <= B:
    if B % i == 0:
        while B % i == 0:
            B //= i
        setB.add(i)
    i += 1
if B > 1:
    setB.add(B)

print(len(setA & setB) + 1)

