N = gets.to_i

s = ( gets.to_i - 1 ).to_s
(N-1).times do |i|
  c = ( gets.to_i - 1 ).to_s
  next if s[-1] == c
  s += c
end

# p s

cnt = Array.new( 2*(10**5)+1 , nil )

n = s.size
dp = Array.new( n + 1 , nil )

dp[0] = 1

(0...n).each do |i|
  c = s[i].to_i
  
  if cnt[c] && dp[cnt[c]]
    dp[i+1] = dp[i] + dp[cnt[c]+1]
  else
    dp[i+1] = dp[i] 
  end
  cnt[c] = i
  
  # p [dp, cnt[0,7]]
end

# p dp
p dp[-1]



