input: Write a python function that, given a list of positive integers, returns the largest subset that can be placed in a 0-indexed array following the pattern: [x, x2, x4, ..., xk/2, xk, xk/2, ..., x4, x2, x], where k is any non-negative power of 2.
  
  from typing import List
  from collections import Counter
  
  def find_max_pattern_length(nums: List[int]) -> int:
      """
      Given an array of positive integers nums, find the largest subset of nums that can form a sequence following a specific pattern: [x, x2, x4, ..., xk/2, xk, xk/2, ..., x4, x2, x], where k is any non-negative power of 2.
  
      Examples:
      >>> nums = [5, 4, 1, 2, 2]
      3
      >>> nums = [1, 3, 2, 4]
      1
  
      Constraints:
      2 <= nums.length <= 10^5
      1 <= nums[i] <= 10^9
      """
output: def find_max_pattern_length(nums: List[int]) -> int:
      count = Counter(nums)
      result = 0
      
      for x in sorted(count.keys()):
          if count[x] > 0:
              length = 0
              while x in count and count[x] > 0:
                  count[x] -= 1
                  x *= 2
                  length += 1
              result = max(result, length)
      
      return result