{"raw_statement":[{"iden":"statement","content":"Pavel cooks barbecue. There are _n_ skewers, they lay on a brazier in a row, each on one of _n_ positions. Pavel wants each skewer to be cooked some time in every of _n_ positions in two directions: in the one it was directed originally and in the reversed direction.\n\nPavel has a plan: a permutation _p_ and a sequence _b_1, _b_2, ..., _b__n_, consisting of zeros and ones. Each second Pavel move skewer on position _i_ to position _p__i_, and if _b__i_ equals 1 then he reverses it. So he hope that every skewer will visit every position in both directions.\n\nUnfortunately, not every pair of permutation _p_ and sequence _b_ suits Pavel. What is the minimum total number of elements in the given permutation _p_ and the given sequence _b_ he needs to change so that every skewer will visit each of 2_n_ placements? Note that after changing the permutation should remain a permutation as well.\n\nThere is no problem for Pavel, if some skewer visits some of the placements several times before he ends to cook. In other words, a permutation _p_ and a sequence _b_ suit him if there is an integer _k_ (_k_ ≥ 2_n_), so that after _k_ seconds each skewer visits each of the 2_n_ placements.\n\nIt can be shown that some suitable pair of permutation _p_ and sequence _b_ exists for any _n_."},{"iden":"input","content":"The first line contain the integer _n_ (1 ≤ _n_ ≤ 2·105) — the number of skewers.\n\nThe second line contains a sequence of integers _p_1, _p_2, ..., _p__n_ (1 ≤ _p__i_ ≤ _n_) — the permutation, according to which Pavel wants to move the skewers.\n\nThe third line contains a sequence _b_1, _b_2, ..., _b__n_ consisting of zeros and ones, according to which Pavel wants to reverse the skewers."},{"iden":"output","content":"Print single integer — the minimum total number of elements in the given permutation _p_ and the given sequence _b_ he needs to change so that every skewer will visit each of 2_n_ placements."},{"iden":"examples","content":"Input\n\n4\n4 3 2 1\n0 1 1 1\n\nOutput\n\n2\n\nInput\n\n3\n2 3 1\n0 0 0\n\nOutput\n\n1"},{"iden":"note","content":"In the first example Pavel can change the permutation to 4, 3, 1, 2.\n\nIn the second example Pavel can change any element of _b_ to 1."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":null,"simple_statement":null,"has_page_source":false}