#include #include #include #include #include #include #include // string, to_string, stoi #include // vector #include // min, max, swap, sort, reverse, lower_bound, upper_bound #include // pair, make_pair #include // tuple, make_tuple #include // int64_t, int*_t #include // printf #include // map #include // queue, priority_queue #include // set #include // stack #include // deque #include // unordered_map #include // unordered_set #include // bitset #include // isupper, islower, isdigit, toupper, tolower using namespace std; using ll = long long; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) ll Max(ll(a), ll(b), ll(c)) { return max(max(a, b), c); } ll Min(ll(a), ll(b), ll(c)) { return min(min(a, b), c); } ll gcd(ll(a), ll(b)) { ll c = a; while (a % b != 0) { c = a % b; a = b; b = c; } return b; } int main() { ll N; cin >> N ; vector S(N); rep(i, N) { cin >> S.at(i); } ll an = 0; for (ll a1 = 0; a1 < N - 2; a1++) { for (ll a2 = a1+1; a2 < N - 1; a2++) { for (ll a3 = a2+1; a3 < N ; a3++) { if (gcd(gcd(S[a1], S[a2]), S[a3]) == 1)an++; } } } cout << an << endl; }