\textit{Looking at problems ``K-Shaped Figures'' and ``H-Shaped Figures'' from the past two years, you took the warning seriously. You came prepared. For each of the remaining 24 letters of the alphabet, you theorized what the problem could be. You even implemented all 24 solutions and used up all of your Digital Team Reference Document space just to bring these codes to the contest. If the judges are so unoriginal that they set another problem about letter shapes, you'll just get it accepted on minute 1 and leave everyone puzzled.}

\textit{What, another shapes problem? Really?! Ha-ha! Oh... wait a second...}

Let's say that two circles on a plane form an \textit{8-shaped figure} if they touch each other, but neither of them lies inside the other one.
% \vspace{-0.15cm}
\begin{center}
  \begin{tabular}{c@{\hspace{4em}}|@{\hspace{4em}}c}
    \includegraphics{pic-1.eps} & \includegraphics{pic-2.eps}\\
    \small{Valid 8-shaped figures} & \small{Invalid 8-shaped figures}
  \end{tabular}
\end{center}

You are given a collection of $n$ circles on the plane. No two circles have more than one common point. In~other words, no two circles intersect twice or coincide, but they can touch or lie one within another.

Find the number of pairs of circles from this collection that form an 8-shaped figure.