Thread:Extension talk:CategoryTree/How do I filter pages?

I want to list all the pages in Category:Foo but only pages that are both in Category:Foo and Category:Bar. And vice-versa too, that is list all pages in Category:Foo that aren't in Category:Bar.