import java.util.*; import java.io.*; public class Main { static HashMap[] maps; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String[] first = br.readLine().split(" ", n); int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = Integer.parseInt(first[i]); } maps = new HashMap[n]; for (int i = 0; i < n; i++) { maps[i] = new HashMap(); } System.out.println(getCount(0, arr, -1)); } static long getCount(int idx, int[] arr, int value) { if (idx >= arr.length) { return 0; } if (maps[idx].containsKey(value)) { return maps[idx].get(value); } long count = getCount(idx + 1, arr, value); int next; if (value == -1) { next = arr[idx]; } else { next = gcd(value, arr[idx]); } if (next == 1) { count += (long)(Math.pow(2, arr.length - idx - 1)); } else { count += getCount(idx + 1, arr, next); } maps[idx].put(value, count); return count; } static int gcd(int x, int y) { if (x % y == 0) { return y; } else { return gcd(y, x % y); } } }