/* -*- coding: utf-8 -*- * * 1146.cc: No.1146 土偶Ⅰ - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 100; /* typedef */ /* global variables */ int as[MAX_N]; /* subroutines */ template T gcd(T m, T n) { // m > 0, n > 0 if (m < n) swap(m, n); while (n > 0) { T r = m % n; m = n; n = r; } return m; } /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", as + i); int cnt = 0; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) { int g = gcd(as[i], as[j]); for (int k = j + 1; k < n; k++) if (gcd(g, as[k]) == 1) cnt++; } printf("%d\n", cnt); return 0; }