First-principles study of ferromagnetism in N doped TiO2 and TiO