Function counting script