Bit++

Practice this coding question on Coding Gurukul.

Problem statement

A counter begins at zero. Process a sequence of operations, each increasing or decreasing the counter by one. The increment forms are ++X and X++; the decrement forms are --X and X--. Report the final counter value.

Input format

First line: n. Next n lines: one operation each.

Output format

Print the final counter value.

Constraints

1 <= n <= 150; each operation is ++X, X++, --X or X--.

Sample input

4
++X
X--
X++
++X

Sample output

2

Sign in to run or submit a solution in C++, Java or Python.