#K40007. Minimum Number of Cables
Minimum Number of Cables
Minimum Number of Cables
You are given an integer \(N\) representing the number of servers in a network. Your task is to determine the minimum number of cables required to connect all the servers such that every server is reachable from any other server.
In a connected network (i.e. a tree), the minimum number of cables needed is \(N - 1\) when \(N \geq 1\). For the cases when \(N = 0\) or \(N = 1\), no cable is required.
Note: The answer can be formally written as \(\max(0, N-1)\).
inputFormat
The input consists of a single integer \(N\) on a single line, where \(N\) is the number of servers.
outputFormat
Output a single integer representing the minimum number of cables required to connect \(N\) servers so that every server is reachable from any other server.
## sample4
3
</p>