replacing count by length