No strange things are done now, because sed gives us ‘wc -l’ functionality for free!!! Look:
sed
#!/usr/bin/sed -nf $=