#include #include #include #include #include #include #include #include #include using namespace std; int main() { int n, gcd1, gcd2, cnt = 0; cin >> n; vector a(n); for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++){ for (int j = i+1; j < n; j++){ gcd1 = gcd(a[i], a[j]); if (gcd1 == 1) cnt += (n-j-1); else { for (int k = j+1; k < n; k++){ if (gcd(gcd1, a[k]) == 1) cnt++; } } } } cout << cnt << endl; }