import java.util.*; public class Main { static int n; static int[] arr; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n = sc.nextInt(); arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = sc.nextInt(); } System.out.println(search(0, -1)); } static long search(int idx, int value) { if (idx >= n) { return 0; } long ans = search(idx + 1, value); if (value == -1) { value = arr[idx]; } else { value = gcd(value, arr[idx]); } if (value == 1) { ans += (long)(Math.pow(2, n - idx - 1)); } else { ans += search(idx + 1, value); } return ans; } static int gcd(int x, int y) { if (x % y == 0) { return y; } else { return gcd(y, x % y); } } }