n = gets.to_i
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)
a_sort = a.sort
b_sort = b.sort
a_count = 0
b_count = 0
no_count = 0
(0..n-1).each do |i|
  a_count += 1 if a[i] != a_sort[i]
  b_count += 1 if b[i] != b_sort[i]
  no_count += 1 if b_sort[i] < a_sort[i] 
end
if no_count > 0 || b_count - a_count > n - 1
  puts "No"
else
  puts "Yes"
end
  
