  Let $D^-$ and $D^+$ be properly immersed closed locally convex subsets of a
Riemannian manifold with pinched negative sectional curvature. Using mixing
properties of the geodesic flow, we give an asymptotic formula as $t\to+\infty$
for the number of common perpendiculars of length at most $t$ from $D^-$ to
$D^+$, counted with multiplicities, and we prove the equidistribution in the
outer and inner unit normal bundles of $D^-$ and $D^+$ of the tangent vectors
at the endpoints of the common perpendiculars. When the manifold is compact
with exponential decay of correlations or arithmetic with finite volume, we
give an error term for the asymptotic. As an application, we give an asymptotic
formula for the number of connected components of the domain of discontinuity
of Kleinian groups as their diameter goes to $0$.
