Efficient inversion of magnetotelluric data in two dimensions