Unable to count all fragments from a script (attached)

Dear all,

I am counting the number of fragments in a system (by fragment, I mean each entity linked with at least one chemical bond) with the following script I wrote :

#!perl
use strict;
use warnings;
use MaterialsScript qw(:all);
my \$molecules = \$Documents{"input.xsd"}->Molecules;
my \$frag = \$molecules-> Count;
print " number of fragments :" ,\$frag

However, on my input the script gives 17 fragments as a result while I can count more fragments by eye. 
Could you please let me know what my script is missing ? I attached my input for testing.

Thanks in advance
Best regards