info

MAPS OS v1.1.4 © 2025

Glory to the Segtree

Glory to the Algorithm.

FunctionGo home

Login to view input

no submission

Login to submit an answer

Problem Leaderboard

Problem Leaderboard

Function

Parsa is tired of making up stories, so he’ll give you the statement straight. You are given a function f defined as follows:
1. f(1) = 2.
2. If n is even, then f(n) = floor(f(n - 1) / 2) * ceil(f(n - 1) / 2)
3. If n is odd, then f(n) = f(n - 1) - 4.
Given n, output the value of f(n).

Input Format:

The first line an integer n.

Output:

Output f(n).

Sample Input:

8

Sample Output:

2