# util functions

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

# input
lpre = nil
l = $stdin.gets

cnt = 1
h_run = {} # num => incr
while l = $stdin.gets do
  lcur = l.to_i
  next if lpre == lcur
  lpre = lcur

  if h_run[ lcur ] == nil
    h_run[ lcur ] = cnt
  else
    cnt += h_run[ lcur ]
    h_run[ lcur ] = cnt
  end

end

print "ans: " if $debugFlag
puts cnt % (10**9 + 7)