You have n oranges. Each day you must choose exactly one of the following actions:
- Eat one orange.
- If the current number of oranges is divisible by
2, eat half of them. - If the current number is divisible by
3, eat two thirds of them.
Return the fewest days needed to eat every orange.
Example 1:
Input: n = 3
Output: 2Explanation: Eat two oranges on the first day using the divisible-by-3 action, then eat the last orange on the second day.
Example 2:
Input: n = 4
Output: 3Explanation: Eat half to leave two oranges, then one orange on each of the next two days. Three days are necessary.
Example 3:
Input: n = 1
Output: 1Explanation: Eat the only orange in one day.
Constraints:
1 <= n <= 2000000000