{"raw_statement":[{"iden":"problem statement","content":"There are $N$ stones arranged in a row. The $i$\\-th stone from the left is painted in the color $C_i$.\nSnuke will perform the following operation zero or more times:\n\n*   Choose two stones painted in the same color. Repaint all the stones between them, with the color of the chosen stones.\n\nFind the number of possible final sequences of colors of the stones, modulo $10^9+7$."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 2\\times 10^5$\n*   $1 \\leq C_i \\leq 2\\times 10^5(1\\leq i\\leq N)$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$C_1$\n$:$\n$C_N$"},{"iden":"sample input 1","content":"5\n1\n2\n1\n2\n2"},{"iden":"sample output 1","content":"3\n\nWe can make three sequences of colors of stones, as follows:\n\n*   $(1,2,1,2,2)$, by doing nothing.\n*   $(1,1,1,2,2)$, by choosing the first and third stones to perform the operation.\n*   $(1,2,2,2,2)$, by choosing the second and fourth stones to perform the operation."},{"iden":"sample input 2","content":"6\n4\n2\n5\n4\n2\n4"},{"iden":"sample output 2","content":"5"},{"iden":"sample input 3","content":"7\n1\n3\n1\n2\n3\n3\n2"},{"iden":"sample output 3","content":"5"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}