An even sequence has the following property: each maximal contiguous subsequence which contains only equal integers (i.e. the same integer repeated a number of times) has an even length. In particular, the empty sequence is even. A subsequence is maximal if it is not contained in a larger contiguous subsequence which contains only equal integers.
Chef was given an integer sequence $A_1, A_2, \ldots, A_N$ by his friend Mr. Z. He may perform the following operation any number of times: either delete an element of the current sequence (if it is non-empty) or insert an integer anywhere in the current sequence (possibly at the beginning or at the end).
Find the minimum number of operations needed to make the sequence even.

-----Input-----
- The first line of the input contains a single integer $T$ denoting the number of test cases. The description of $T$ test cases follows.
- The first line of each test case contains a single integer $N$.
- The second line contains $N$ space-separated integers $A_1, A_2, \ldots, A_N$.

-----Output-----
For each test case, print a single line containing one integer — the minimum number of operations.

-----Constraints-----
- $1 \leq T \leq 10$
- $1 \leq N \leq 2 \cdot 10^5$
- $1 \leq A_i \leq N$ for each valid $i$
- the sum of $N$ over all test cases does not exceed $2 \cdot 10^6$

-----Subtasks-----
Subtask #1 (10 points): $N \leq 18$
Subtask #2 (10 points): $A_i \leq A_{i+1}$ for each valid $i$
Subtask #3 (20 points): $N \leq 3,000$
Subtask #4 (20 points): $A_i \leq 26$ for each valid $i$
Subtask #5 (40 points): original constraints

-----Example Input-----
2
4
1 1 2 1
11
2 2 2 10 2 10 1 1 5 3 5

-----Example Output-----
2
3

-----Explanation-----
Example case 1: Here are two ways to make the sequence even using $2$ operations:
- Delete the first element $1$ and the only element $2$, resulting in a sequence $(1, 1)$, which is even.
- Delete the last element $1$ and insert $2$ at the end, resulting in a sequence $(1,1,2,2)$, which is even.
It can be proved that one operation is not enough to make the initial sequence even.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = "import sys\nfrom functools import partial\n\nSAMPLE_IN = 'sample.in'\nSAMPLE_ANS = 'sample.ans'\n\n\ndef read_int(f) -> int:\n return int(f.readline())\n\ndef read_ints(f) -> list:\n return [int(x) for x in f.readline().split()]\n\ndef read_case(f=sys.stdin) -> tuple:\n n = read_int(f)\n nums = read_ints(f)\n return n, nums\n\n\ndef solve(n, nums):\n even = 0\n odd = [-1] * (n+1)\n for x in nums:\n  even, odd[x] = max(even, odd[x] + 1), even + 1\n return n - even\n\n\ndef make_submission(fin=sys.stdin, fout=sys.stdout):\n output = partial(print, file=fout)\n n_cases = int(fin.readline())\n for t in range(1, n_cases + 1):\n  case = read_case(fin)\n  answer = solve(*case)\n  output(answer)\n\n\ndef __starting_point():\n import os\n if os.getenv('GCJ_LOCAL'):\n  with open(SAMPLE_IN) as s:\n   make_submission(s)\n else:\n  make_submission()\n\n__starting_point()"
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 15685