def f(n)
  if n == 1
    return 1, 1
  elsif n % 2 == 0
    a, b = f(n / 2)
    return 2 * a * b - a ** 2, a ** 2 + b ** 2
  else
    a, b = f(n / 2)
    return a ** 2 + b ** 2, 2 * a * b + b ** 2
  end
end
puts f(gets.to_i + 1)[0]