from math import gcd, sqrt, ceil

n = int(input())
a = list(map(int, input().split()))

a = list(set(a))
divisor = a[0]
for ai in a[1:]:
    divisor = gcd(divisor, ai)

result = 1      # 1 is always a divisor
limit = ceil(sqrt(divisor)) + 1
primes = [2] + list(range(3, limit, 2))
for prime_factor in primes:
    power = 0
    while divisor % prime_factor == 0:
        divisor /= prime_factor
        power += 1
    if power > 0:
        result *= 1 + power

print(result)

from math import gcd, sqrt, ceil

n = int(input())
a = list(map(int, input().split()))

a = list(set(a))
divisor = a[0]
for ai in a[1:]:
    divisor = gcd(divisor, ai)

result = 1      # 1 is always a divisor
limit = divisor // 2 + 1
primes = [2] + list(range(3, limit, 2))
for prime_factor in primes:
    if prime_factor > divisor:
        break
    power = 0
    while divisor % prime_factor == 0:
        divisor /= prime_factor
        power += 1
    result *= 1 + power

print(result)

Fix WA 10: remove limit heuristics
Fix WA 10: remove limit heuristics

- in CF Div 3 579C

Signed-off-by: Karel Ha <70f8965fdfb04f1fc0e708a55d9e822c449f57d3@gmail.com>

  from math import gcd, sqrt, ceil
  
  n = int(input())
  a = list(map(int, input().split()))
  
  a = list(set(a))
  divisor = a[0]
  for ai in a[1:]:
      divisor = gcd(divisor, ai)
  
  result = 1      # 1 is always a divisor
- limit = ceil(sqrt(divisor)) + 1
+ limit = divisor // 2 + 1
  primes = [2] + list(range(3, limit, 2))
  for prime_factor in primes:
+     if prime_factor > divisor:
+         break
      power = 0
      while divisor % prime_factor == 0:
          divisor /= prime_factor
          power += 1
-     if power > 0:
-         result *= 1 + power
+     result *= 1 + power
  
  print(result)
  
Fix WA 10: remove limit heuristics
## Code Before:
from math import gcd, sqrt, ceil

n = int(input())
a = list(map(int, input().split()))

a = list(set(a))
divisor = a[0]
for ai in a[1:]:
    divisor = gcd(divisor, ai)

result = 1      # 1 is always a divisor
limit = ceil(sqrt(divisor)) + 1
primes = [2] + list(range(3, limit, 2))
for prime_factor in primes:
    power = 0
    while divisor % prime_factor == 0:
        divisor /= prime_factor
        power += 1
    if power > 0:
        result *= 1 + power

print(result)

## Instruction:
Fix WA 10: remove limit heuristics
## Code After:
from math import gcd, sqrt, ceil

n = int(input())
a = list(map(int, input().split()))

a = list(set(a))
divisor = a[0]
for ai in a[1:]:
    divisor = gcd(divisor, ai)

result = 1      # 1 is always a divisor
limit = divisor // 2 + 1
primes = [2] + list(range(3, limit, 2))
for prime_factor in primes:
    if prime_factor > divisor:
        break
    power = 0
    while divisor % prime_factor == 0:
        divisor /= prime_factor
        power += 1
    result *= 1 + power

print(result)
