I want to count the number of matches there is on one single line (or all lines as there always will be only one line).
I want to count not just one match per line as in
Maybe you should convert spaces to newlines first:
$ echo "1 1 2 2 2 5" | tr ' ' $'\n' | grep -c 2 3