PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000170. Số lượng ước chung (Number of common divisors)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Số lượng ước chung (Number of common divisors)

Number of common divisors

Source: SPOJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given two positive integers AA and BB, a positive integer dd is a common divisor if both numbers are divisible by dd. Count the distinct positive common divisors without listing them.

Input

One line containing two positive integers A,BA,B.

Output

Print the number of positive common divisors of AA and BB.

Subtasks

  • Subtask 1 (20 points): 1≤A,B≤1031 \le A,B \le 10^3.
  • Subtask 2 (30 points): 1≤A,B≤1051 \le A,B \le 10^5.
  • Subtask 3 (50 points): 1≤A,B≤1061 \le A,B \le 10^6.

Examples

Input

12 24

Output

6

Explanation

The common divisors of 1212 and 2424 are 1,2,3,4,6,121,2,3,4,6,12, giving 66 divisors.