Good afternoon!

I have a collection of XML files in which all files contain the attribute //ENDERECO-PROFISISONAL/@UF

In which UF is the province in which the person to whom the file makes reference to lives.

I want to develop a query that returns to me the number of occurences of each province in the collection. I've tried using count and distinct-values, but it always return the value "1" for me.

The query I'm trying to use is the following:
for $x in collection('Teste500')/CURRICULO-VITAE/DADOS-GERAIS/ENDERECO/ENDERECO-PROFISSIONAL
let $y := count(distinct-values($x/@UF))
return $y

The desired result would be, in a collection of documents in which 5 people live in SP, 3 in DF and 9 in AM would be the following:

SP: 5
DF: 3
AM:9

Can somebody please help me with that? I'm still struggling with xQuery.