Question
Topsy-Turvy Total

You are given n numbers one by one. Your task is to calculate a Zigzag Total — start with adding the first number, then subtract the second, then add the third, and so on, alternating between addition and subtraction for each number entered.

Try to use only basic variables and loops to implement the logic.

Input
The first line contains an integer n, representing how many numbers will be entered.
The next n lines each contain one integer.
Output
Print the final Zigzag Total after performing all alternating operations.
Example
Example 1:
Input:
5
10
5
8
3
6

Process:
10 − 5 + 8 − 3 + 6 = 16

Output:
16

Example 2:
Input:
4
7
2
9
5

Process:
7 − 2 + 9 − 5 = 9

Output:
9

Explanation:
The first number is added, the second is subtracted, the third is added, and so on.
The process continues alternately until all numbers are processed.
The final computed value is printed as the Zigzag Total.

Online