Statistical Mechanics of Recurrent Neural Networks I. Statics