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