the den ezio needed to reach was located not far from the bazaar , in the imperial district , between the bazaar itself and the ancient church of haghia sofia , now converted by the ottomans into a mosque .