def encode_var(variable: str) -> int:
	"""
	Encodes a label into a number

	Returns the index of the variable in the sequence:

	```
	Y, X1, Z1, X2, Z2, X3, Z3, ...
	```

	X and Z are interpretted as X1 and Z1, respectively.
	"""
	if variable == "Y":
		return 1
	index = int(variable[1:]) if len(variable) > 1 else 1
	offset = {"X": 0, "Z": 1}[variable[0]]
	return index * 2 + offset