Added dynamic “N” parameter to Flag function

For more details about the Flag function see: here