PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#QHD0000028. Cây sinh trưởng (Growing Trees)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Cây sinh trưởng (Growing Trees)

Growing Trees

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

A mathematical tree grows level by level. At each level, each existing branch either splits into two branches or remains a single branch. Its growth follows these rules:

  • At level 11, the tree does not branch.
  • If a branch does not split at level ii, that branch must split at level i+1i+1.
  • If a branch splits at level ii, exactly one of its two new branches splits at level i+1i+1, while the other does not.

Branches never merge. A leaf is an endpoint of a branch at the level being observed. Given a growth level nn, determine the number of leaves at that level.

It does not matter which one of the two children splits: the total number of leaves remains the same.

Input

One line containing a positive integer nn, the level of growth to examine.

Output

Print the number of leaves at level nn.

Subtasks

  • Subtask 1 (20 points): 1≤n≤151\le n\le 15.
  • Subtask 2 (30 points): 1≤n≤451\le n\le 45.
  • Subtask 3 (50 points): 1≤n≤851\le n\le 85.

Examples

Input

3

Output

2

Explanation

Under the growth rules, the leaf counts at the first two levels are both 11. At level 33, the count equals the sum for the preceding two levels: 1+1=21+1=2. Thus the answer is 22.