It's slightly unclear what you want (since `uniq` will only remove _adjacent_ duplicates) however assuming you want to print all the unique field-counts across records _regardless of adjacency_ you could use
awk '!seen[NF]++ {print NF}' file.txt