n,*a=$<.read.split;a.sort!;p a.count{|i|a[i-1]!=a[i]&&a[i]!=a[i+1]}