If you get a wired kb, it will use one of your open USB ports, but it has 2 more USB out ports. You can use 1 for your mouse, but you still have one left, plus whatever is leftover on the machine. In the case of the iMac, you have 3 total on it. So you would still have 2 left on the machine and 1 left on the kb.
With a wireless mouse and kb, you can get a BT module installed internally, so you don't lose any slots anyway. All 3 are still available.
You will really want a hub with your imac if your going wireless. Having on 3 usb ports would drive me nuts. I suffer with 3. I will be getting a hub very soon.