Updated select count query to use long as count range.