Description

The Fibonacci numbers F(n) form a sequence where F(n) = F(n-1) + F(n-2), with F(0) = 0 and F(1) = 1.

Examples

Input:n = 4
Output:3
Explanation:

F(4) = F(3) + F(2) = 2 + 1 = 3.

Input:n = 0
Output:0
Explanation:

F(0) = 0 by definition.

Input:n = 6
Output:8
Explanation:

F(6) = F(5) + F(4) = 5 + 3 = 8. The sequence is: F(0)=0, F(1)=1, F(2)=1, F(3)=2, F(4)=3, F(5)=5, F(6)=8.

Constraints

  • 0 ≤ n ≤ 30

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!