# include # include # include # include # include # include # include # include # include # include # include using namespace std; # define lowbit(x) ((x)&(-x)) # define pi 3.1415926535 # define eps 1e-9 # define MOD 20100403 # define INF 1000000000 # define mem(a,b) memset(a,b,sizeof(a)) # define FOR(i,a,n) for(int i=a; i<=n; ++i) # define FO(i,a,n) for(int i=a; i PII; typedef vector VI; # pragma comment(linker, "/STACK:1024000000,1024000000") typedef long long LL; int Scan() { int res=0, flag=0; char ch; if((ch=getchar())=='-') flag=1; else if(ch>='0'&&ch<='9') res=ch-'0'; while((ch=getchar())>='0'&&ch<='9') res=res*10+(ch-'0'); return flag?-res:res; } void Out(int a) { if(a<0) {putchar('-'); a=-a;} if(a>=10) Out(a/10); putchar(a%10+'0'); } const int N=100005; //Code begin... mapvis; LL a[N]; int to[N]; int main () { int n, ans, T; scanf("%d",&T); while (T--) { vis.clear(); mem(to,0); ans=0; scanf("%d",&n); FOR(i,1,n) { scanf("%I64d",a+i); if (vis.find(a[i])!=vis.end()) to[i]=vis[a[i]]; vis[a[i]]=i; } int now=1; while (now<=n) { int i=now; for (; i<=n; ++i) if (to[i]>=now) break; ++ans; now=i; } printf("%d\n",ans); } return 0; }