  For an arbitrary transient random walk $(S_n)_{n\ge 0}$ in $\mathbb Z^d$,
$d\ge 1$, we prove a strong law of large numbers for the spatial sum
$\sum_{x\in\mathbb Z^d}f(l(n,x))$ of a function $f$ of the local times
$l(n,x)=\sum_{i=0}^n\mathbb I\{S_i=x\}$. Particular cases are the number of
  (a) visited sites (first time considered by Dvoretzky and Erd\H{o}s), which
corresponds to a function $f(i)=\mathbb I\{i\ge 1\}$;
  (b) $\alpha$-fold self-intersections of the random walk (studied by Becker
and K\"{o}nig), which corresponds to $f(i)=i^\alpha$;
  (c) sites visited by the random walk exactly $j$ times (considered by
Erd\H{o}s and Taylor and by Pitt), where $f(i)=\mathbb I\{i=j\}$.
