#P11775. Set Union Merging

    ID: 13870 Type: Default 1000ms 256MiB

Set Union Merging

Set Union Merging

Given \( n \) sets, where the \( i\)-th set initially contains only element \( i \). Each day, you can perform arbitrarily many operations. In one operation, you choose two sets \( A \) and \( B \), compute \( C = A \cup B \), and update both sets as \( A \gets C \) and \( B \gets C \). However, each set can only be chosen once per day. Determine the minimum number of days required so that after a sequence of operations, every set becomes \( \{1, 2, 3, \dots, n\} \).

inputFormat

A single integer \( n \) (with \( 1 \le n \le 10^9 \)) representing the number of sets.

outputFormat

Output the minimum number of days required.

sample

1
0