If you count the characters without hex:
$ sed 's/\([^\]*\)\\x[0-9A-Fa-f][0-9A-Fa-f]/\1/g' dummy_hex.txt | LC_ALL=C wc -c
14
And substract that from the whole file count:
$ <dummy_hex.txt wc -c dummy_hex.txt
30
You could get the count of hex characters (times 4). In one script:
#!/bin/bash
a=$(sed 's/\([^\]*\)\\x[0-9A-Fa-f][0-9A-Fa-f]/\1/g' dummy_hex.txt | wc -c)
b=$(<dummy_hex.txt wc -c dummy_hex.txt)
count=$(( (b-a)/4 ))
echo "$count"
Prints:
$ ./script
4
Remember that wc counts bytes (not locale dependent characters).