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 = 'from sys import stdin,stdout\nimport math,bisect\nfrom collections import Counter,deque,defaultdict\nL=lambda:list(map(int, stdin.readline().strip().split()))\nM=lambda:list(map(int, stdin.readline().strip().split()))\nI=lambda:int(stdin.readline().strip())\nS=lambda:stdin.readline().strip()\nC=lambda:stdin.readline().strip().split()\ndef pr(a):return(" ".join(list(map(str,a))))\n#_________________________________________________#\n\nm = 2*pow(10,5)+1\ndef solve():\n    n = I()\n    a = L()\n    b = [-1]*m\n    c = [0]*m\n    ans = 0\n    for i in range(n):\n        if b[a[i]]==-1:\n            b[a[i]] = i\n        elif i-b[a[i]]==1:\n            b[a[i]] = i\n            c[a[i]]+=1\n            ans = max(ans,c[a[i]])\n        elif i-b[a[i]]==2:\n            b[a[i]] = i\n            c[a[i]]+=1\n            ans = max(ans,c[a[i]])\n        else:\n            b[a[i]] = i\n            c[a[i]] = 0\n    print(ans)\nfor _ in range(I()):\n    solve()\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 3208147