Count Connected Components in LCM Graph