def is_majority(arr, n, x):
    # Find first occurrence of x using binary search
    low, high = 0, n - 1
    first = -1
    
    while low <= high:
        mid = (low + high) // 2
        if arr[mid] == x:
            first = mid
            high = mid - 1
        elif arr[mid] < x:
            low = mid + 1
        else:
            high = mid - 1
    
    if first == -1:
        return False
    
    # Check if element at first + n//2 is also x
    last_index = first + n // 2
    
    if last_index < n and arr[last_index] == x:
        return True
    
    return False