How can i set the pin?

You have to do that sequentially, unless you can arrange for all the pins to be on the same port,up to a maximum of eight inputs