# Bash, 77 bytes
<!-- language: lang-sh -->

    IFS=$'\n '
    f=(`factor $1`)
    g=(`uniq<<<"${f[*]}"`)
    echo $((${#f[*]}-${#g[*]}))

Complete program, with input in `$1` and output to stdout.

We set `IFS` to begin with a newline, so that the expansion `"${f[*]}"` is newline-separated.  We use arithmetic substitution to print the difference between the number of words in the factorisation with the result of filtering through `uniq`.  The number itself is printed as a prefix by `factor`, but it is also present after filtering, so falls out in the subtraction.