code: private static <E> ImmutableSet<E> constructUnknownDuplication(int n, Object... elements) {
      // Guess the size is "halfway between" all duplicates and no duplicates, on a log scale.
      return construct(
          n,
          Math.max(
              ImmutableCollection.Builder.DEFAULT_INITIAL_CAPACITY,
              IntMath.sqrt(n, RoundingMode.CEILING)),
          elements);
    }
docs: Constructs an {@code ImmutableSet} from the first {@code n} elements of the specified array,
  which we have no particular reason to believe does or does not contain duplicates. If {@code k}
  is the size of the returned {@code ImmutableSet}, then the unique elements of {@code elements}
  will be in the first {@code k} positions, and {@code elements[i] == null} for {@code k <= i <
  n}.
  
  <p>This may modify {@code elements}. Additionally, if {@code n == elements.length} and {@code
  elements} contains no duplicates, {@code elements} may be used without copying in the returned
  {@code ImmutableSet}, in which case the caller must not modify it.
  
  <p>{@code elements} may contain only values of type {@code E}.
  
  @throws NullPointerException if any of the first {@code n} elements of {@code elements} is null