N people at an algorithm camp gather at the front of the classroom and sit in a circle. They are numbered 0 through N−1 counterclockwise.
Every participant is either honest or a liar. An honest person always tells the truth, and a liar always tells a lie.
The host asked each person whether the person sitting to their right is a liar. An honest person answers truthfully and a liar answers falsely. Both an honest person and a liar may refuse to answer.
Given the answers, write a program that prints the smallest possible number of liars if some assignment of honest people and liars produces exactly those answers, and −1 if no assignment does.