import java.util.*

fun main(args: Array<String>) {
    val n= readLine()!!.toInt()
    val prev= Array(n){0}
    val hash = HashMap<Long , Int>()
    val c = Array(n){
        val ci =readLine()!!.toLong()
        prev[it]= hash[ci]?:-1
        hash[ci]=it
        ci
    }
    val result = Array<Long>(n){0}
    result[0]=1
    if(n>1)result[1]=1
    for (i in 2 until n){
        result[i]+=result[i-1]
        result[i] %=1000000007.toLong()
        if( prev[i]>=0&&prev[i]!=i-1){
            result[i]+=result[prev[i]]
        }
        result[i] %=1000000007.toLong()
    }
    print(result[n-1])
}