#K95052. Final Value After Operations

    ID: 38777 Type: Default 1000ms 256MiB

Final Value After Operations

Final Value After Operations

You are given a series of operations to perform on an integer variable n that is initially set to 0. Each operation is either n++ (which increases n by 1) or n-- (which decreases n by 1). The number of operations is given by an integer k, followed by k lines, each containing one of the two operations.

You are required to read from standard input and compute the final value of n after applying all operations in the order given. Use the following process:

$$n = n + \Delta$$

where \(\Delta = 1\) if the operation is n++ and \(\Delta = -1\) if the operation is n--.

inputFormat

The input is provided via stdin and consists of multiple lines:

  • The first line contains an integer k representing the number of operations.
  • The next k lines each contain one operation, which is either n++ or n--.

outputFormat

Output a single integer to stdout representing the final value of n after performing all the operations.

## sample
3
n++
n++
n--
1

</p>