Using stream counting algorithm