#B4079. The Magical Coin Tree

    ID: 11736 Type: Default 1000ms 256MiB

The Magical Coin Tree

The Magical Coin Tree

George dreams of visiting a mystical tribe whose magical tree rewards every newcomer with coins that increase as time goes on. Specifically, during:

  • Week 1: George receives 1 coin per day.
  • Week 2: George receives 2 coins per day.
  • Week 3: George receives 3 coins per day.
  • ... and so on.

Given an integer \(n\), determine the minimum number of days required for George to accumulate at least \(n\) coins.

Note: The coins for each week are awarded daily. For instance, if \(n = 8\), then after 7 days George has 7 coins, and on day 8 (the first day of week 2) he receives 2 coins, making a total of 9 coins.

inputFormat

The input consists of a single integer \(n\) (\(1 \leq n \leq 10^{12}\)), representing the target number of coins to accumulate.

outputFormat

Output a single integer, the minimum number of days required for George to have at least \(n\) coins.

sample

1
1