import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { // your code goes here // 入力 Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[] A = new int[N]; for(int i = 0; i < N; i++){ A[i] = sc.nextInt(); } // カウント int count = 0; for(int i = 0; i < N; i++){ int a = A[i]; for(int j = i+1; j < N; j++){ int b = A[j]; for(int k = j+1; k < N; k++){ int c = A[k]; int gcd = euclid(a,b); gcd = euclid(gcd,c); if(gcd == 1){ count++; } } } } // 出力 System.out.println(count); } // 最大公約数を求める関数 public static int euclid(int a, int b){ if(a < b){ int tmp = a; a = b; b = tmp; } if(a % b == 0){ return b; } return euclid(b, a%b); } }