since they are text just use
=LEN(D2)-LEN(SUBSTITUTE(D2,"1",""))