#include using namespace std; typedef long long LL; typedef long double LB; typedef pair PII; typedef pair PLL; typedef vector VI; const int INF = 0x3f3f3f3f; const LL INFL = 0x3f3f3f3f3f3f3f3fLL; const double eps = 1e-8; const double PI = acos(-1.0); template inline bool scan_d (T &ret) { char c; int sgn; if (c = getchar(), c == EOF) return 0; //EOF while (c != '-' && (c < '0' || c > '9') ) c = getchar(); sgn = (c == '-') ? -1 : 1; ret = (c == '-') ? 0 : (c - '0'); while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0'); ret *= sgn; return 1; } template void print(T x) { static char s[33], *s1; s1 = s; if (!x) *s1++ = '0'; if (x < 0) putchar('-'), x = -x; while(x) *s1++ = (x % 10 + '0'), x /= 10; while(s1-- != s) putchar(*s1); } template void println(T x) { print(x); putchar('\n');} const int MAXN = 100000 + 5; LL T, N, C[MAXN]; set st; int main() { #ifdef ___LOCAL_WONZY___ freopen("input.txt", "r", stdin); #endif // ___LOCAL_WONZY___ scan_d(T); while(T --) { scan_d(N); for(int i = 0; i < N; ++i) scan_d(C[i]); st.clear(); int ans = 0; for(int i = 0; i < N; ++i) { if(st.empty() || st.find(C[i]) == st.end()) st.insert(C[i]); else st.clear(), st.insert(C[i]), ++ ans; } if(!st.empty()) ++ ans; println(ans); } return 0; }