  The precision and discovery potential of a neutrino factory based on muon
storage rings is studied. For three-family neutrino oscillations, we analyse
how to measure or severely constraint the angle $\theta_{13}$, CP violation,
MSW effects and the sign of the atmospheric mass difference $\Delta m^2_{23}$.
We present a simple analytical formula for the oscillation probabilities in
matter, with all neutrino mass differences non-vanishing, which clarifies the
subtleties involved in disentangling the unknown parameters. The appearance of
``wrong-sign muons'' at three reference baselines is considered: 732 km, 3500
km, and 7332 km. We exploit the dependence of the signal on the neutrino
energy, and include as well realistic background estimations and detection
efficiencies. The optimal baseline turns out to be ${\cal O}(3000$ km).
Analyses combining the information from different baselines are also presented.
