n = Integer(STDIN.gets.chomp) line_pattern = (0...n).map{|x| 1 << x} pattern = {} (0...n).map{|x| 1 << x}.each do |x| line_pattern.each do |y| if x & y == 0 pattern[[x, y, x | y]] = 1 end end end next_pattern = {} pattern.each_key do |k| next_pattern[k[0]] = line_pattern.select{|x| k[0] & (x << 1 | x >> 1) == 0} end (3..n).each do |i| new_pattern = {} new_pattern.default = 0 pattern.each do |k, v| next_pattern[k[0]].select{|x| k[2] & x== 0}.each do |x| y = [k[1], x, k[2] | x] new_pattern[y] = new_pattern[y] + v end end pattern = new_pattern end puts pattern.each_value.sum