Network
To set up the olympiad, the organizers aim to connect the participants' computers into a network. They have N switches at their disposal and an unlimited supply of network cables. Each switch, labeled i (1 ≤ i ≤ N), has a_i ports available.
The organizers can use cables to connect two switches, two computers, or a switch and a computer. Each switch can connect to no more than a_i devices (either switches or computers), while each computer can connect to only one device.
Two computers can communicate if there is a cable path between them, which may involve passing through multiple switches. The goal is to construct the network so that any two computers can exchange data.
Determine the maximum number of computers that can be connected to the network using the available switches.
Input
The first line of the input contains a single integer N, representing the number of switches available (0 ≤ N ≤ 10^5). The second line contains N integers a_i, where a_i is the number of ports on switch i (1 ≤ a_i ≤ 10^9, 1 ≤ i ≤ N).
Output
Output a single integer representing the maximum number of computers that can be connected in the network using the available switches.