reduce alts to a set *before* counting them