This question is somewhat similar to Count the number of elements of each size in a list. It should actually be simpler but I nevertheless can't figure out how to do it without using the same code as in the other question and then add all the values together (which is overkill, I assume).
Code with question incorporated
\documentclass{article}
\def\valueA{35762}
\def\valueB{62525}
\def\valueC{67102}
\def\valueD{38990}
\def\valueE{1993}
\def\valueF{42762}
\def\valueG{22098}
\def\valueH{28900}
\def\valueI{45596}
\def\valueJ{38495}
\def\valueK{196292}
\begin{document}
\noindent The elements have the values\\[0.5\baselineskip]
\valueA\\
\valueB\\
\valueC\\
\valueD\\
\valueE\\
\valueF\\
\valueG\\
\valueH\\
\valueI\\
\valueJ\\
\valueK\\[0.5\baselineskip]
but how do I make \LaTeX{} automatically count the number of elements above? (The answer is $11$ in this case.)
\end{document}
Notice that all the elements are defined via \def
.
:)