#K93427. Maximum Knight Moves
Maximum Knight Moves
Maximum Knight Moves
You are given a positive integer n and an array of n positive integers. Each element in the array represents a value. The task is to calculate the maximum number of moves a knight can perform, computed by the formula:
\( \text{max_moves} = \sum_{i=1}^{n} a_i - n \)
In other words, add all the integers of the array and subtract n from the sum. Your program should read the input from stdin and output the result to stdout.
inputFormat
The input is given via standard input with two lines:
- The first line contains a single integer n, representing the number of elements in the array.
- The second line contains n space-separated integers, which are the values of the array.
outputFormat
Output a single integer which is the maximum number of moves the knight can perform, computed as the sum of the array values minus n.
## sample3
2 3 4
6