select 
     isnull(a.A,b.A) as A,
     (a.N1 + b.N2)   as NumN
from
     (select A,count(N) as N1 from t where N=1 group by A) a
full outer join
     (select A,count(distinct N) as N2 from t where N<>1 group by A) b
on
     a.A = b.A