Fizza is a cute girl and she wants to be more beautiful.
So she approached a magician to increase her beauty magically. But the magician's 
glasses accidently got locked inside the locker and he forgot the password. Without
glasses he can't help her. The password is hidden in N integers i.e. $a[1], a[2], ..... a[N]$ 
written on his magical stick.The password is the maximum number of moves Fizza can perform, for any position $i$ such that 1 < = $i$ < = $N$ and integer $X$ is present at $i$-th
position. In one move she can perform one of the following operations ->
$(1)$  If ( $i$ + 1 < = $N$ ) she can go to position ($i$ + 1 ) if integer at ( $i$ + 1 )-th 
position is equal to $X$.
$(2)$ if ( $i$ + 2 < = $N$ ) she can go to position ($i$ + 2 ) if integer at ($i$ + 2)-th 
position is equal to $X$.
Fizza is a bit worried about her beauty so she can't focus on the problem but she asked for 
your help to find the password.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- Each testcase consists of  two lines of input.
- Input $N$.
- Input $N$ integers . 

-----Output:-----
For each testcase, output in a single line Maximum number of moves.

-----Constraints-----
- $1 \leq T \leq 100$
- $1 \leq N \leq 10^5$
- $1 \leq a[i] \leq 2*10^5$

-----Sample Input:-----
3
8
6 3 6 4 5 4 3 6
9
5 5 4 5 2 1 3 4 2
6
1 2 3 4 5 6

-----Sample Output:-----
1
2
0

-----EXPLANATION:-----
In the first case, integers at position 1 and 3 are the same and at alternate positions.
In the second case, integers at position 1, 2, 4 follow the conditions.

```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 = 'for _ in range(int(input())):\r\n    n = int(input())\r\n    arr = list(map(int, input().split()))\r\n\r\n    if len(arr) <= 1:\r\n        print(0)\r\n        continue\r\n    mx = 0\r\n    narr = [0]\r\n    narr.append(0 if arr[1]!=arr[0] else 1)\r\n    for i in range(2, n):\r\n        if arr[i-2] == arr[i] and arr[i-1] == arr[i]:\r\n            narr.append(max(narr[-2], narr[-1])+1)\r\n        elif arr[i-1] == arr[i]:\r\n            narr.append(narr[-1]+1)\r\n        elif arr[i-2] == arr[i]:\r\n            narr.append(narr[-2]+1)\r\n        else:\r\n            narr.append(0)\r\n        mx = max(mx, narr[-1])\r\n    print(mx)'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 13607