# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

# input
lpre = nil
l = $stdin.gets

input = []
while l = $stdin.gets do
  lcur = l.to_i
  next if lpre == lcur
  input << lcur
  lpre = lcur
end

hh = {}
dp = []
input.size.times do |i|
  if i == 0
    dp[i] = 1
    hh[input[i]] = 1
    next
  end
  if hh[input[i]] == nil
    dp[i] = dp[i-1]
    hh[input[i]] = dp[i]
  else
    dp[i] = dp[i-1] + hh[input[i]]
    hh[input[i]] = dp[i]
  end
end

puts dp[-1] % (10**9 + 7)
