How to count grouped rows

Let’s suppose we have rows
1.A
2.A
3.B
4.B
5.B
6.C
7…

The same rows count only ones. So from the example above I should have 1( for A’s), 1( for B’s), 1( for C’s) , so together we will get 3. Is it possible to use GROUP function for that in LibreOffice Calc? Or is there a better method? The content is a text( string), not a number.
Thank you for help.

Hallo

=SUM(1/COUNTIF(A1:A100;A1:A100))

replace A1:A100 with the exact Range with Contents in every cell.
enter the Formula as matrix-formula with ctrl+shift+enter respective the [x]matrix -Option in Formulawizard

Thanks for the reply. I tried that but receive an error #VALUE!. There are alse strings, not only numbers in cells
ANy other idea? Thanks

Ok, lets try:

 =SUM(IFERROR(1/COUNTIF(A1:A100;A1:A100);""))

check the [x]Matrixoption in Formulawizard

Thanks for the reply but unfortunatelly it still does not work. Still error #VALUE!
To repeat my problem.
I have row 1 with value A
row 2 with value A
row 3 with value B
row 4 value B
row 5 value B
row 6 value C
how can I group the rows to get totals 3( 1( for A’s), 1( for B’s), 1( for C’s) , so together we will get 3.)
?
The values on rows are strings, not numbers.
Thank you for your feedbacks

@Jana1
don’t you realize check the [x]Matrixoption in Formulawizard

Attached a sample file with @karolus solution, the second formula is needed when there are empty cells in the range.

Sample file