Wild Ones
In this problem, you're given a list of numbers and must calculate their sum.
This problem is like other problems where you are given an integer representing the length of the list, followed by the list's elements. However, there is a catch.
In addition to the list's elements, there may be a series of \(1\)s dispersed throughout the list. These \(1\)s must be ignored when calculating the sum of the list! Additionally, they do not count towards the reported length of the list.
Input
First, you are given an integer \(1 \leq n \leq 10\), representing the amount of integers in the list. This number does not account for the \(1\)s randomly dispersed throughout the list.
Then, you are given at least \(n\) integers \(1 \leq a_i \leq 100\). This sequence will contain containly exactly \(n\) integers that are not \(1\).
Output
The output consists of a single integer: the sum of all integers in the sequence that are not \(1\).
Examples
Example 1
Input:
3
4 10 1 2
In this example, there are \(3\) elements that are not \(1\).
Output:
16
The sum of all \(3\) elements that are not \(1\) is \(16\).
Example 2
Input:
1
1 1 1 1 2 1 1
Output:
2
Example 3
Input:
2
4 5
Output:
9
Comments