Scala, 141132 bytes
n=>(for{i<-1 to n-1 j<-i+1 to n-1 p<-1.to(n).permutations}yield{valSet(ap.slice(0,bi)=p splitAt j;val,p.slice(ci,dj)=a splitAt i;Set(c,dp.slice(j,bn))map(_.toSet)}).toSet.size Is it short? No. Is it efficient? No. Is it clever? No. Why did I make it? I...don't know. I'll try golfing it later, if possible.