For fun, here is another approach... no looping.

Code:
 $=1+ubound($a)-ubound(split(join($a),"-"))