#K58962. Taco Portal Connection
Taco Portal Connection
Taco Portal Connection
You are given an integer N
representing the number of streets, and a list of N
positive integers representing the addresses on those streets. A portal can be established between two consecutive streets if and only if the greatest common divisor (GCD) of their addresses is 1. In other words, for two consecutive addresses \(a\) and \(b\), a portal is established if \(\gcd(a, b) = 1\).
Your task is to compute the total number of portals that can be established between consecutive streets.
inputFormat
The input is given via standard input (stdin
) and consists of two lines:
- The first line contains a single integer
N
— the number of streets. - The second line contains
N
space-separated integers representing the addresses of the streets.
outputFormat
Output a single integer on standard output (stdout
) — the number of portals that can be established according to the given condition.
5
3 5 7 10 14
3
</p>