CountFragments function

Count fragments