AbsDistinct solution