fork download
  1. for i in range(int(input())):
  2. s=int(input())
  3. v=list(map(int,input().split()))
  4. for i in range(0,len(v)-1):
  5. if((v[i]==v[i+1])):
  6.  
  7. v[i]=-1
  8.  
  9. p=v.count(-1)
  10. print(len(v)-p)
Success #stdin #stdout 0.03s 9356KB
stdin
4
1
5
2
1 1
3
1 2 3
4
2 1 2 2
stdout
1
1
3
3