Ionic adsorption and equilibrium distribution of charges in a nematic cell