adding count to flags