Calculation Of Nuclear Level Densities Near The Drip Lines