#include #include using namespace std; using namespace atcoder; using ll = long long; using ld = long double; int main() { int n; cin >> n; vector a(n + 1); int ans = 0; for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { for (int k = j + 1; k <= n; k++) { if (gcd(gcd(a[i], a[j]), a[k]) == 1) ans++; } } } cout << ans << endl; return 0; }