#P11003. Liars in Blue Bridge Village
Liars in Blue Bridge Village
Liars in Blue Bridge Village
In the picturesque Blue Bridge Village, n villagers sit around an ancient round table. Each villager is either a truth‐teller or an inveterate liar. When the debate begins, each villager numbered \(i\) makes the following assertion:
"Among the two villagers sitting immediately after me (namely, villagers \(i+1\) and \(i+2\) in a circular order), one is telling the truth and the other is lying."
A truth‐teller's statement must be true, meaning that if villager \(i\) is honest then \[ A_{i+1} \oplus A_{i+2} = 1, \] where \(A_j=1\) if villager \(j\) tells the truth and \(0\) otherwise. A liar's statement is false, so if \(A_i=0\) then \[ A_{i+1} \oplus A_{i+2} = 0, \] which implies that the two villagers immediately after \(i\) are either both honest or both liars.
Every configuration of villagers must satisfy these conditions in a circular manner (i.e. indices wrap around modulo \(n\)). Among all valid configurations, determine the sum of liars (the total number of villagers with \(A=0\)) across all possible configurations.
inputFormat
The input consists of a single integer \(n\) (\(n \ge 3\)), representing the number of villagers.
outputFormat
Output a single integer: the sum of liars (\(A=0\)) over all valid configurations that satisfy the villagers' statements.
sample
3
6