The first line contains one integer - the length of sequence .The second line contains integers - the elements of sequence .The third line contains integers - the elements of sequence .
Print one number - the number of beautiful sequences.
4 7 5 5 7 9 5
2