n = gets.to_i
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)

def search(a, b)
  a.sort.zip(b.sort).each do |twin|
    return false if twin[0] > twin[1]
  end
  true
end

def check(a, b)
  flag = false

  a.zip(b).each do |twin|
    if !flag
      flag = true if twin[0] - twin[1] != 1
    else
      return true if twin[0] - twin[1] != 1
    end
  end
  false
end

if search(a, b) && check(a, b)
  puts 'Yes'
else
  puts 'No'
end