#include #define pb push_back #define fr first #define sc second using namespace std; typedef pair PII; typedef long long ll; const double eps = 1e-10; int dcmp(double x) { if(fabs(x) < eps) return 0; else return x>0?1:-1; } const int N = 1e5+5; int a[N]; set s; int main() { int T; cin >> T; while(T--) { s.clear(); int n, x, ans = 0; scanf("%d", &n); for(int i = 0; i < n; i++) { scanf("%d", &x); if(s.find(x) != s.end()) { ans++; s.clear(); } s.insert(x); } if(!s.empty()) ans++; cout << ans << endl; } return 0; }