#K49952. Minimum Turns to Destroy Targets
Minimum Turns to Destroy Targets
Minimum Turns to Destroy Targets
Alice is given a set of targets placed at different positions along a number line. In each turn, she must travel from the origin to a target to destroy it and then return to the origin. The goal is to determine the minimum number of turns required to destroy all targets. Note that the distance for a single target is twice the absolute value of its position. Formally, if there are t targets with positions \(p_1, p_2, \dots, p_t\), then the total number of turns required is given by:
\[ 2 \sum_{i=1}^{t} |p_i| \]
Your task is to compute this value.
inputFormat
The first line contains an integer (t) denoting the number of targets. The second line contains (t) space-separated integers, each representing the position of a target.
outputFormat
Output a single integer representing the minimum number of turns required for Alice to destroy all targets.## sample
3
3 -2 5
20