/\*
A statement in language Bit++ is a sequence, consisting of exactly one operation
and one variable x. The statement is written without spaces, that is, it can only
contain characters "+", "-", "X".
Executing a statement means applying the operation it contains.

Operation ++ increases the value of variable x by 1.

Operation -- decreases the value of variable x by 1.
\*/

```
import java.util.regex.*;
import java.util.Scanner;

public class Bit{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        sc.nextLine();
        int x = 0;

        while(n-->0){
            Pattern p1 = Pattern.compile("[+]{2}");
            Matcher m1 = p1.matcher(sc.nextLine());
            boolean b1 = m1.matches();

            if(b1){
                ++x;
            }else{
                --x;
            }
        }
        System.out.println(x);
    }
}

```

For the input

2

++x

--x

The ouput should be 0 my code is giving output as -2.

Codeforces 282A.