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