program prob6
    implicit none
    integer(8)::n, i, j, t, ans
    integer(8)::c(200005), dp(0:200005), last(0:200005)
    integer, parameter::mod2 = 1000000007
    c = 0
    dp = 0
    last = 0
    read(*,*) n
    do i = 1, n
        read(*,*) t
        c(t) = c(t) + 1
        dp(i) = dp(i-1) + dp(last(t))
        if(i - last(t) == 1) dp(i) = dp(i) - dp(i-1)
        dp(i) = mod(dp(i),mod2)
        dp(1) = 1
        last(t) = i
        !write(*,*) dp(i)
    end do
    write(*,*) dp(n)
    stop
end program