import sys from math import gcd from functools import reduce from collections import defaultdict def compute_gcd(arr): return reduce(lambda x, y: gcd(x, y), arr) def get_prime_factors(num): factors = set() if num == 1: return factors # Process even factors if num % 2 == 0: factors.add(2) while num % 2 == 0: num //= 2 # Process odd factors i = 3 while i * i <= num: if num % i == 0: factors.add(i) while num % i == 0: num //= i i += 2 # Process remaining factor if num > 1: factors.add(num) return factors def main(): input = sys.stdin.read().split() n = int(input[0]) arr = list(map(int, input[1:n+1])) # Check overall GCD overall_gcd = compute_gcd(arr) if overall_gcd != 1: print(0) return # Initialize structures to track divisors and their properties d_to_k = dict() cnt = defaultdict(int) for num in arr: primes = get_prime_factors(num) m = len(primes) primes_list = list(primes) # Generate all subsets of primes to form divisors for mask in range(1 << m): d = 1 k = 0 for j in range(m): if (mask >> j) & 1: d *= primes_list[j] k += 1 cnt[d] += 1 # Record the number of primes used for this divisor if d not in d_to_k: d_to_k[d] = k sum_ans = 0 for d in cnt: k = d_to_k[d] mu = (-1) ** k c = cnt[d] sum_ans += mu * ((1 << c) - 1) print(sum_ans) if __name__ == "__main__": main()