I found an interesting problem on https://codeforces.com/problemset/problem/1006/A:
Mishka got an integer array $a$ of length $n$ as a birthday present (what a surprise!).

Mishka doesn't like this present and wants to change it somehow. He has invented an algorithm and called it "Mishka's Adjacent Replacements Algorithm". This algorithm can be represented as a sequence of steps:  Replace each occurrence of $1$ in the array $a$ with $2$;  Replace each occurrence of $2$ in the array $a$ with $1$;  Replace each occurrence of $3$ in the array $a$ with $4$;  Replace each occurrence of $4$ in the array $a$ with $3$;  Replace each occurrence of $5$ in the array $a$ with $6$;  Replace each occurrence of $6$ in the array $a$ with $5$;  $\dots$  Replace each occurrence of $10^9 - 1$ in the array $a$ with $10^9$;  Replace each occurrence of $10^9$ in the array $a$ with $10^9 - 1$. 

Note that the dots in the middle of this algorithm mean that Mishka applies these replacements for each pair of adjacent integers ($2i - 1, 2i$) for each $i \in\{1, 2, \ldots, 5 \cdot 10^8\}$ as described above.

For example, for the array $a = [1, 2, 4, 5, 10]$, the following sequence of arrays represents the algorithm: 

$[1, 2, 4, 5, 10]$ $\rightarrow$ (replace all occurrences of $1$ with $2$) $\rightarrow$ $[2, 2, 4, 5, 10]$ $\rightarrow$ (replace all occurrences of $2$ with $1$) $\rightarrow$ $[1, 1, 4, 5, 10]$ $\rightarrow$ (replace all occurrences of $3$ with $4$) $\rightarrow$ $[1, 1, 4, 5, 10]$ $\rightarrow$ (replace all occurrences of $4$ with $3$) $\rightarrow$ $[1, 1, 3, 5, 10]$ $\rightarrow$ (replace all occurrences of $5$ with $6$) $\rightarrow$ $[1, 1, 3, 6, 10]$ $\rightarrow$ (replace all occurrences of $6$ with $5$) $\rightarrow$ $[1, 1, 3, 5, 10]$ $\rightarrow$ $\dots$ $\rightarrow$ $[1, 1, 3, 5, 10]$ $\rightarrow$ (replace all occurrences of $10$ with $9$) $\rightarrow$ $[1, 1, 3, 5, 9]$. The later steps of the algorithm do not change the array.

Mishka is very lazy and he doesn't want to apply these changes by himself. But he is very interested in their result. Help him find it.


-----Input-----

The...

I tried it in Python, but could not do it. Can you solve it?
n = int(input())
lst = [int(x) for x in input().split()]
for i in range(len(lst)):
    if lst[i]%2==0:
        lst[i]-=1
lst = [str(x) for x in lst]
print(' '.join(lst))