fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

fn main() {
    let input = read_vec::<usize>();
    let (n, m) = (input[0], input[1]);
    let mut v = Vec::with_capacity(n);

    let ax = read_vec::<usize>();
    for a in ax {
        v.push(a);
    }

    for _ in 0..m {
        v.sort();
        v[n-1] = v[n-1] / 2;
    }

    let ans: usize = v.into_iter().sum();

    println!("{}", ans);
}


struct Heap<Element: Comparable>: SequenceType, GeneratorType {
    var items = [Element]()
    var i = 0
    mutating func next() -> Element? {
        defer { i += 1 }
        return i < items.count ? items[i] : nil
    }
    mutating func push(item: Element) {
        var i = items.count
        while i > 0 {
            let p = (i - 1) / 2
            if items[p] <= item {
                break
            }
            if i == items.count {
                items.append(items[p])
            } else {
                items[i] = items[p]
            }
            i = p
        }
        if i == items.count {
            items.append(item)
        } else {
            items[i] = item
        }
    }
    mutating func pop() -> Element {
        let ret = items[0]
        let x = items[items.count - 1]
        var i: Int = 0
        while i * 2 + 1 < items.count - 1 {
            var a = i * 2 + 1
            let b = i * 2 + 2
            if b < items.count - 1 && items[b] < items[a] {
                a = b
            }
            if items[a] >= x {
                break
            }
            items[i] = items[a]
            i = a
        }
        items[i] = x
        _ = items.removeLast()
        return ret
    }
}
let M = Int(String(readLine()!.characters.split(" ")[1]))!
var a = Heap<Int>()
readLine()!.characters.split(" ").forEach{a.push(-Int(String($0))!)}
(0..<M).forEach{_ in a.push(a.pop()/2)}
print(a.reduce(0){$0-$1})


import Foundation
import CoreFoundation

#if swift(>=4.0)
prefix operator *
infix operator **: PowerPrecedence
precedencegroup PowerPrecedence {
    higherThan: MultiplicationPrecedence
    lowerThan: BitwiseShiftPrecedence
    associativity: right
}
#else
extension String {
    func split(separator separator: Character) -> [String] {
        return self.characters.split(separator).map{String($0)}
    }
    var count: Int {
        return self.characters.count
    }
    var first: Character? {
        return self.characters.first
    }
    var last: Character? {
        return self.characters.last
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
    func reversed() -> ReverseCollection<String.CharacterView> {
        return self.characters.reverse()
    }
    func forEach(body: (Character) -> Void) {
        return self.characters.forEach{body($0)}
    }
    func map<T>(transform: (Character) -> T) -> [T] {
        return self.characters.map{transform($0)}
    }
    func reduce<Result>(initialResult: Result, _ nextPartialResult: (Result, Character) -> Result) -> Result {
        return self.characters.reduce(initialResult){nextPartialResult($0, $1)}
    }
    func filter(isIncluded: (Character) -> Bool) -> String {
        return String(self.characters.filter{isIncluded($0)})
    }
    func enumerated() -> EnumerateSequence<String.CharacterView> {
        return self.characters.enumerate()
    }
}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted(by areInIncreasingOrder: (Element, Element) -> Bool = {$0 < $1}) -> [Element] {
        return self.sort(areInIncreasingOrder)
    }
    mutating func sort(by areInIncreasingOrder: (Element, Element) -> Bool = {$0 < $1}) {
        self.sortInPlace(areInIncreasingOrder)
    }
}
extension Array {
    mutating func swapAt(i: Int, _ j: Int) {
        swap(&self[i], &self[j])
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func reverse() {
        self = self.reversed()
    }
    func enumerated() -> EnumerateSequence<[Element]> {
        return self.enumerate()
    }
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
extension _ArrayType where Generator.Element == String {
    func joined(separator separator: String = "") -> String {
        return self.joinWithSeparator(separator)
    }
}
extension Range {
    func reversed() -> [Element] {
        return self.reverse()
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
prefix operator * { }
infix operator ** {
    precedence 155      // 乗除算より強く，ビットシフトより弱い
    associativity right // 右結合
}
#endif
prefix func * <T> (a: [T]) -> (T, T)             { return (a[0], a[1]) }
prefix func * <T> (a: [T]) -> (T, T, T)          { return (a[0], a[1], a[2]) }
prefix func * <T> (a: [T]) -> (T, T, T, T)       { return (a[0], a[1], a[2], a[3]) }
prefix func * <T> (a: [T]) -> (T, T, T, T, T)    { return (a[0], a[1], a[2], a[3], a[4]) }
prefix func * <T> (a: [T]) -> (T, T, T, T, T, T) { return (a[0], a[1], a[2], a[3], a[4], a[5]) }
func **(lhs: Int, rhs: Int) -> Int {
    return Int(pow(Double(lhs), Double(rhs)))
}
func **(lhs: Int, rhs: Double) -> Double {
    return pow(Double(lhs), rhs)
}
func * <Element> (lhs: [Element], rhs: Int) -> [Element] {
    return (0..<rhs).flatMap{_ in lhs}
}
func *(lhs: String, rhs: Int) -> String {
    return (0..<rhs).reduce(""){s,_ in s+lhs}
}
let MOD = 10 ** 9 + 7
let alphabets = "abcdefghijklmnopqrstuvwxyz"
let ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
//protocol Container {
//    associatedtype Item
//    mutating func append(item: Item)
//    var count: Int { get }
//    subscript(i: Int) -> Item { get }
//}
struct Stack<Element>: SequenceType, GeneratorType {
    var items = [Element]()
    var i = 0
    mutating func next() -> Element? {
        defer { i += 1 }
        return i < items.count ? items[i] : nil
    }
    mutating func push(item: Element) {
        items.append(item)
    }
    mutating func pop() -> Element {
        return items.removeLast()
    }
    mutating func append(item: Element) {
        self.push(item)
    }
    var count: Int {
        return items.count
    }
    subscript(i: Int) -> Element {
        return items[i]
    }
}
struct Queue<Element>: SequenceType, GeneratorType {
    var items = [Element]()
    var i = 0
    mutating func next() -> Element? {
        defer { i += 1 }
        return i < items.count ? items[i] : nil
    }
    mutating func push(item: Element) {
        items.append(item)
    }
    mutating func pop() -> Element {
        return items.removeFirst()
    }
    mutating func append(item: Element) {
        self.push(item)
    }
    var count: Int {
        return items.count
    }
    subscript(i: Int) -> Element {
        return items[i]
    }
}
struct Heap<Element: Comparable>: SequenceType, GeneratorType {
    var items = [Element]()
    var i = 0
    mutating func next() -> Element? {
        defer { i += 1 }
        return i < items.count ? items[i] : nil
    }
    mutating func push(item: Element) {
        var i = items.count
        while i > 0 {
            let p = (i - 1) / 2
            if items[p] <= item {
                break
            }
            if i == items.count {
                items.append(items[p])
            } else {
                items[i] = items[p]
            }
            i = p
        }
        if i == items.count {
            items.append(item)
        } else {
            items[i] = item
        }
    }
    mutating func pop() -> Element {
        let ret = items[0]
        let x = items[items.count - 1]
        var i: Int = 0
        while i * 2 + 1 < items.count - 1 {
            var a = i * 2 + 1
            let b = i * 2 + 2
            if b < items.count - 1 && items[b] < items[a] {
                a = b
            }
            if items[a] >= x {
                break
            }
            items[i] = items[a]
            i = a
        }
        items[i] = x
        _ = items.removeLast()
        return ret
    }
    mutating func append(item: Element) {
        self.push(item)
    }
    var count: Int {
        return items.count
    }
    subscript(i: Int) -> Element {
        return items[i]
    }
}
extension Array where Element: Equatable {
    func count(of value: Element) -> Int {
        return self.reduce(0){$0+($1==value ? 1 : 0)}
    }
}
extension String {
    func count(of value: Character) -> Int {
        return self.reduce(0){$0+($1==value ? 1 : 0)}
    }
    subscript(i: Int) -> Character {
        return self.map{$0}[i]
    }
}
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringsSplit(by separator: Character = " ") -> [String] {
    return readLine()!.split(separator: separator).map{String($0)}
}
func readIntsSplit(by separator: Character = " ") -> [Int] {
    return readLine()!.split(separator: separator).map{Int($0)!}
}
func gcd(x: Int, _ y: Int) -> Int {
    return y>0 ? gcd(y, x%y) : x
}
func lcm(x: Int, _ y: Int) -> Int {
    return x * y / gcd(x, y)
}
func manhattanDistance(x1: Int, _ y1: Int, _ x2: Int, _ y2: Int) -> Int {
    return abs(x1 - x2) + abs(y1 - y2)
}
func euclideanDistance(x1: Int, _ y1: Int, _ x2: Int, _ y2: Int) -> Double {
    return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
}

/*************** メインプログラム ***************/

let (N, M) = *readIntsSplit()
var a = Heap<Int>()
readIntsSplit().forEach{a.push(-$0)}
(0..<M).forEach{_ in a.push(a.pop()/2)}
print(a.reduce(0){$0-$1})


import Foundation
import CoreFoundation

#if swift(>=4.0)
prefix operator *
infix operator **: PowerPrecedence
precedencegroup PowerPrecedence {
    higherThan: MultiplicationPrecedence
    lowerThan: BitwiseShiftPrecedence
    associativity: right
}
#else
extension String {
    func split(separator separator: Character) -> [String] {
        return self.characters.split(separator).map{String($0)}
    }
    var count: Int {
        return self.characters.count
    }
    var first: Character? {
        return self.characters.first
    }
    var last: Character? {
        return self.characters.last
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
    func reversed() -> ReverseCollection<String.CharacterView> {
        return self.characters.reverse()
    }
    func forEach(body: (Character) -> Void) {
        return self.characters.forEach{body($0)}
    }
    func map<T>(transform: (Character) -> T) -> [T] {
        return self.characters.map{transform($0)}
    }
    func reduce<Result>(initialResult: Result, _ nextPartialResult: (Result, Character) -> Result) -> Result {
        return self.characters.reduce(initialResult){nextPartialResult($0, $1)}
    }
    func filter(isIncluded: (Character) -> Bool) -> String {
        return String(self.characters.filter{isIncluded($0)})
    }
    func enumerated() -> EnumerateSequence<String.CharacterView> {
        return self.characters.enumerate()
    }
}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted(by areInIncreasingOrder: (Element, Element) -> Bool = {$0 < $1}) -> [Element] {
        return self.sort(areInIncreasingOrder)
    }
    mutating func sort(by areInIncreasingOrder: (Element, Element) -> Bool = {$0 < $1}) {
        self.sortInPlace(areInIncreasingOrder)
    }
}
extension Array {
    mutating func swapAt(i: Int, _ j: Int) {
        swap(&self[i], &self[j])
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func reverse() {
        self = self.reversed()
    }
    func enumerated() -> EnumerateSequence<[Element]> {
        return self.enumerate()
    }
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
extension _ArrayType where Generator.Element == String {
    func joined(separator separator: String = "") -> String {
        return self.joinWithSeparator(separator)
    }
}
extension Range {
    func reversed() -> [Element] {
        return self.reverse()
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
prefix operator * { }
infix operator ** {
    precedence 155      // 乗除算より強く，ビットシフトより弱い
    associativity right // 右結合
}
#endif
prefix func * <T> (a: [T]) -> (T, T)             { return (a[0], a[1]) }
prefix func * <T> (a: [T]) -> (T, T, T)          { return (a[0], a[1], a[2]) }
prefix func * <T> (a: [T]) -> (T, T, T, T)       { return (a[0], a[1], a[2], a[3]) }
prefix func * <T> (a: [T]) -> (T, T, T, T, T)    { return (a[0], a[1], a[2], a[3], a[4]) }
prefix func * <T> (a: [T]) -> (T, T, T, T, T, T) { return (a[0], a[1], a[2], a[3], a[4], a[5]) }
func **(lhs: Int, rhs: Int) -> Int {
    return Int(pow(Double(lhs), Double(rhs)))
}
func **(lhs: Int, rhs: Double) -> Double {
    return pow(Double(lhs), rhs)
}
func * <Element> (lhs: [Element], rhs: Int) -> [Element] {
    return (0..<rhs).flatMap{_ in lhs}
}
func *(lhs: String, rhs: Int) -> String {
    return (0..<rhs).reduce(""){s,_ in s+lhs}
}
let MOD = 10 ** 9 + 7
let alphabets = "abcdefghijklmnopqrstuvwxyz"
let ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
//protocol Container {
//    associatedtype Item
//    mutating func append(item: Item)
//    var count: Int { get }
//    subscript(i: Int) -> Item { get }
//}
struct Stack<Element>: SequenceType, GeneratorType {
    var items = [Element]()
    var i = 0
    mutating func next() -> Element? {
        defer { i += 1 }
        return i < items.count ? items[i] : nil
    }
    mutating func push(item: Element) {
        items.append(item)
    }
    mutating func pop() -> Element {
        return items.removeLast()
    }
    mutating func append(item: Element) {
        self.push(item)
    }
    var count: Int {
        return items.count
    }
    subscript(i: Int) -> Element {
        return items[i]
    }
}
struct Queue<Element>: SequenceType, GeneratorType {
    var items = [Element]()
    var i = 0
    mutating func next() -> Element? {
        defer { i += 1 }
        return i < items.count ? items[i] : nil
    }
    mutating func push(item: Element) {
        items.append(item)
    }
    mutating func pop() -> Element {
        return items.removeFirst()
    }
    mutating func append(item: Element) {
        self.push(item)
    }
    var count: Int {
        return items.count
    }
    subscript(i: Int) -> Element {
        return items[i]
    }
}
struct Heap<Element: Comparable>: SequenceType, GeneratorType {
    var items = [Element]()
    var i = 0
    mutating func next() -> Element? {
        defer { i += 1 }
        return i < items.count ? items[i] : nil
    }
    mutating func push(item: Element) {
        var i = items.count
        while i > 0 {
            let p = (i - 1) / 2
            if items[p] <= item {
                break
            }
            if i == items.count {
                items.append(items[p])
            } else {
                items[i] = items[p]
            }
            i = p
        }
        if i == items.count {
            items.append(item)
        } else {
            items[i] = item
        }
    }
    mutating func pop() -> Element {
        let ret = items[0]
        let x = items[items.count - 1]
        var i: Int = 0
        while i * 2 + 1 < items.count - 1 {
            var a = i * 2 + 1
            let b = i * 2 + 2
            if b < items.count - 1 && items[b] < items[a] {
                a = b
            }
            if items[a] >= x {
                break
            }
            items[i] = items[a]
            i = a
        }
        items[i] = x
        _ = items.removeLast()
        return ret
    }
    mutating func append(item: Element) {
        self.push(item)
    }
    var count: Int {
        return items.count
    }
    subscript(i: Int) -> Element {
        return items[i]
    }
}
extension Array where Element: Equatable {
    func count(of value: Element) -> Int {
        return self.reduce(0){$0+($1==value ? 1 : 0)}
    }
}
extension String {
    func count(of value: Character) -> Int {
        return self.reduce(0){$0+($1==value ? 1 : 0)}
    }
    subscript(i: Int) -> Character {
        return self.map{$0}[i]
    }
}
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringsSplit(by separator: Character = " ") -> [String] {
    return readLine()!.split(separator: separator).map{String($0)}
}
func readIntsSplit(by separator: Character = " ") -> [Int] {
    return readLine()!.split(separator: separator).map{Int($0)!}
}
func gcd(x: Int, _ y: Int) -> Int {
    return y>0 ? gcd(y, x%y) : x
}
func lcm(x: Int, _ y: Int) -> Int {
    return x * y / gcd(x, y)
}
func manhattanDistance(x1: Int, _ y1: Int, _ x2: Int, _ y2: Int) -> Int {
    return abs(x1 - x2) + abs(y1 - y2)
}
func euclideanDistance(x1: Int, _ y1: Int, _ x2: Int, _ y2: Int) -> Double {
    return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
}

/*************** メインプログラム ***************/

let (N, M) = *readIntsSplit()
var a = Heap<Double>()
readIntsSplit().forEach{a.push(-Double($0))}
(0..<M).forEach{_ in a.push(a.pop()/2)}
print(a.reduce(0){$0-Int($1)})


struct Heap<Element: Comparable>: CollectionType {
  var items = [Element]()
  var startIndex: Int {
    return items.startIndex
  }
  var endIndex: Int {
    return items.endIndex
  }
  subscript(i: Int) -> Element {
    return items[i]
  }
  mutating func push(item: Element) {
    var i = items.count
    while i > 0 {
      let p = (i - 1) / 2
      if items[p] <= item {
        break
      }
      if i == items.count {
        items.append(items[p])
      } else {
        items[i] = items[p]
      }
      i = p
    }
    if i == items.count {
      items.append(item)
    } else {
      items[i] = item
    }
  }
  mutating func pop() -> Element {
    let ret = items[0]
    let x = items[items.count - 1]
    var i: Int = 0
    while i * 2 + 1 < items.count - 1 {
      let b = i * 2 + 2
      if b < items.count - 1 && items[b] < items[a] {
        a = b
      }
      if items[a] >= x {
        break
      }
      items[i] = items[a]
      i = a
    }
    items[i] = x
    items.removeLast()
    return ret
  }
}
let M=Int(String(readLine()!.characters.split(" ")[1]))!
var q=Heap<Int>()
readLine()!.characters.split(" ").map{q.push(-Int(String($0))!)}
(0..<M).map{_ in q.push(q.pop()/2)}
print(q.reduce(0){$0-$1})


struct Heap<Element: Comparable>: CollectionType {
  var items = [Element]()
  var startIndex: Int {
    return items.startIndex
  }
  var endIndex: Int {
    return items.endIndex
  }
  subscript(i: Int) -> Element {
    return items[i]
  }
  mutating func push(item: Element) {
    var i = items.count
    while i > 0 {
      let p = (i - 1) / 2
      if items[p] <= item {
        break
      }
      if i == items.count {
        items.append(items[p])
      } else {
        items[i] = items[p]
      }
      i = p
    }
    if i == items.count {
      items.append(item)
    } else {
      items[i] = item
    }
  }
  mutating func pop() -> Element {
    let ret = items[0]
    let x = items[items.count - 1]
    var i: Int = 0
    while i * 2 + 1 < items.count - 1 {
      let b = i * 2 + 2
      if b < items.count - 1 && items[b] < items[a] {
        a = b
      }
      if items[a] >= x {
        break
      }
      items[i] = items[a]
      i = a
    }
    items[i] = x
    _ = items.removeLast()
    return ret
  }
}
let M=Int(String(readLine()!.characters.split(" ")[1]))!
var q=Heap<Int>()
readLine()!.characters.split(" ").map{q.push(-Int(String($0))!)}
(0..<M).map{_ in q.push(q.pop()/2)}
print(q.reduce(0){$0-$1})


import Foundation
import CoreFoundation

#if swift(>=4.0)
prefix operator *
infix operator **: PowerPrecedence
precedencegroup PowerPrecedence {
    higherThan: MultiplicationPrecedence
    lowerThan: BitwiseShiftPrecedence
    associativity: right
}
#else
extension String {
    func split(separator separator: Character) -> [String] {
        return self.characters.split(separator).map{String($0)}
    }
    var count: Int {
        return self.characters.count
    }
    var first: Character? {
        return self.characters.first
    }
    var last: Character? {
        return self.characters.last
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
    func reversed() -> ReverseCollection<String.CharacterView> {
        return self.characters.reverse()
    }
    func forEach(body: (Character) -> Void) {
        return self.characters.forEach{body($0)}
    }
    func map<T>(transform: (Character) -> T) -> [T] {
        return self.characters.map{transform($0)}
    }
    func reduce<Result>(initialResult: Result, _ nextPartialResult: (Result, Character) -> Result) -> Result {
        return self.characters.reduce(initialResult){nextPartialResult($0, $1)}
    }
    func filter(isIncluded: (Character) -> Bool) -> String {
        return String(self.characters.filter{isIncluded($0)})
    }
    func enumerated() -> EnumerateSequence<String.CharacterView> {
        return self.characters.enumerate()
    }
}
extension Array where Element: Comparable {
    func max() -> Element? {
        return self.maxElement()
    }
    func min() -> Element? {
        return self.minElement()
    }
    func sorted(by areInIncreasingOrder: (Element, Element) -> Bool = {$0 < $1}) -> [Element] {
        return self.sort(areInIncreasingOrder)
    }
    mutating func sort(by areInIncreasingOrder: (Element, Element) -> Bool = {$0 < $1}) {
        self.sortInPlace(areInIncreasingOrder)
    }
}
extension Array {
    mutating func swapAt(i: Int, _ j: Int) {
        swap(&self[i], &self[j])
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func reverse() {
        self = self.reversed()
    }
    func enumerated() -> EnumerateSequence<[Element]> {
        return self.enumerate()
    }
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
extension _ArrayType where Generator.Element == String {
    func joined(separator separator: String = "") -> String {
        return self.joinWithSeparator(separator)
    }
}
extension Range {
    func reversed() -> [Element] {
        return self.reverse()
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
prefix operator * { }
infix operator ** {
    precedence 155      // 乗除算より強く，ビットシフトより弱い
    associativity right // 右結合
}
#endif
prefix func * <T> (a: [T]) -> (T, T)             { return (a[0], a[1]) }
prefix func * <T> (a: [T]) -> (T, T, T)          { return (a[0], a[1], a[2]) }
prefix func * <T> (a: [T]) -> (T, T, T, T)       { return (a[0], a[1], a[2], a[3]) }
prefix func * <T> (a: [T]) -> (T, T, T, T, T)    { return (a[0], a[1], a[2], a[3], a[4]) }
prefix func * <T> (a: [T]) -> (T, T, T, T, T, T) { return (a[0], a[1], a[2], a[3], a[4], a[5]) }
func **(lhs: Int, rhs: Int) -> Int {
    return Int(pow(Double(lhs), Double(rhs)))
}
func **(lhs: Int, rhs: Double) -> Double {
    return pow(Double(lhs), rhs)
}
func * <Element> (lhs: [Element], rhs: Int) -> [Element] {
    return (0..<rhs).flatMap{_ in lhs}
}
func *(lhs: String, rhs: Int) -> String {
    return (0..<rhs).reduce(""){s,_ in s+lhs}
}
let MOD = 10 ** 9 + 7
let alphabets = "abcdefghijklmnopqrstuvwxyz"
let ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
protocol Container {
    associatedtype Item
    mutating func append(item: Item)
    var count: Int { get }
    subscript(i: Int) -> Item { get }
}
struct Stack<Element>: Container {
    var items = [Element]()
    mutating func push(item: Element) {
        items.append(item)
    }
    mutating func pop() -> Element {
        return items.removeLast()
    }
    mutating func append(item: Element) {
        self.push(item)
    }
    var count: Int {
        return items.count
    }
    subscript(i: Int) -> Element {
        return items[i]
    }
}
struct Queue<Element>: Container {
    var items = [Element]()
    mutating func push(item: Element) {
        items.append(item)
    }
    mutating func pop() -> Element {
        return items.removeFirst()
    }
    mutating func append(item: Element) {
        self.push(item)
    }
    var count: Int {
        return items.count
    }
    subscript(i: Int) -> Element {
        return items[i]
    }
}
struct Heap<Element: Comparable>: Container {
    var items = [Element]()
    mutating func push(item: Element) {
        var i = items.count
        while i > 0 {
            let p = (i - 1) / 2
            if items[p] <= item {
                break
            }
            if i == items.count {
                items.append(items[p])
            } else {
                items[i] = items[p]
            }
            i = p
        }
        if i == items.count {
            items.append(item)
        } else {
            items[i] = item
        }
    }
    mutating func pop() -> Element {
        let ret = items[0]
        let x = items[items.count - 1]
        var i: Int = 0
        while i * 2 + 1 < items.count - 1 {
            var a = i * 2 + 1
            let b = i * 2 + 2
            if b < items.count - 1 && items[b] < items[a] {
                a = b
            }
            if items[a] >= x {
                break
            }
            items[i] = items[a]
            i = a
        }
        items[i] = x
        _ = items.removeLast()
        return ret
    }
    mutating func append(item: Element) {
        self.push(item)
    }
    var count: Int {
        return items.count
    }
    subscript(i: Int) -> Element {
        return items[i]
    }
}
extension Array where Element: Equatable {
    func count(of value: Element) -> Int {
        return self.reduce(0){$0+($1==value ? 1 : 0)}
    }
}
extension String {
    func count(of value: Character) -> Int {
        return self.reduce(0){$0+($1==value ? 1 : 0)}
    }
    subscript(i: Int) -> Character {
        return self.map{$0}[i]
    }
}
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringsSplit(by separator: Character = " ") -> [String] {
    return readLine()!.split(separator: separator).map{String($0)}
}
func readIntsSplit(by separator: Character = " ") -> [Int] {
    return readLine()!.split(separator: separator).map{Int($0)!}
}
func gcd(x: Int, _ y: Int) -> Int {
    return y>0 ? gcd(y, x%y) : x
}
func lcm(x: Int, _ y: Int) -> Int {
    return x * y / gcd(x, y)
}
func manhattanDistance(x1: Int, _ y1: Int, _ x2: Int, _ y2: Int) -> Int {
    return abs(x1 - x2) + abs(y1 - y2)
}
func euclideanDistance(x1: Int, _ y1: Int, _ x2: Int, _ y2: Int) -> Double {
    return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)
}

/*************** メインプログラム ***************/

let (N, M) = *readIntsSplit()
var a = Heap<Int>()
readIntsSplit().forEach{a.push(-$0)}
(0..<M).forEach{_ in a.push(a.pop()/2)}
print((0..<N).reduce(0){i,_ in i-a.pop()})


import * as fs from "fs";

class MaxHeap<T> {
	private items: Array<T>;
	constructor(items: Array<T>) {
		this.items = items;
		for(let ix: number = this.items.length; ix >= 0; ix--) {
			this.bubbleDown(ix);
		}
	}
	push(item: T): void {
		let i: number = this.items.length;
		this.items.push(item);
		this.bubbleUp(i);
	}
	pop(): T {
		let toReturn: T = this.items[0];
		let poppedElement: T = this.items.pop();
		if (this.items.length > 0) {
			this.items[0] = poppedElement;
			this.bubbleDown(0);
		}
		return toReturn;
	}
	peek(): T {
		return this.items[0];
	}
	size(): number {
		return this.items.length;
	}
	private bubbleUp(ix: number): void {
		if (ix != 0) {
			let p: number = Math.floor((ix-1)/2);
			if (this.items[ix] > this.items[p]) {
				[this.items[ix], this.items[p]] = [this.items[p], this.items[ix]];
				this.bubbleUp(p);
			}
		}
	}
	private bubbleDown(ix: number): void {
		let min_index = ix;
		for(let i = 1; i < 3; i++) {
			if (2*ix+i < this.items.length && this.items[min_index] < this.items[2*ix+i]) {
				min_index = 2*ix+i;
			}
		}
		if (min_index != ix) {
			[this.items[min_index], this.items[ix]] = [this.items[ix], this.items[min_index]]
			this.bubbleDown(min_index);
		}
	}
}

let [line1, line2] = fs.readFileSync("/dev/stdin", "utf8").split("\n");
let [N, M] = line1.split(" ").map(Number);
let A = line2.split(" ").map(Number);

let maxHeap: MaxHeap<number> = new MaxHeap(A);

while (M > 0) {
	maxHeap.push(Math.floor(maxHeap.pop()/2));
	M -= 1;
}

let total = 0;
while (maxHeap.size() > 0) {
	total += maxHeap.pop();
}

console.log(total);


import { readFileSync } from 'fs'
function main() {
  const input = readFileSync('/dev/stdin', 'utf8')
  const inputs = input.trim().split('\n')
  const [n, m] = inputs[0].split(' ').map(v => parseInt(v))
  let list = inputs[1].split(' ').map(v => parseInt(v)).sort((a, b) => b - a)
  for (let i = 0; i < m; i++) {
    list[0] = Math.floor(list[0] / 2)
    for (let k = 1; k < list.length; k++) {
      if (list[0] < list[k]) {
        const sortItem = list[k]
        list.splice(k, 1)
        list.unshift(sortItem)
        break
      }
    }
  }
  let result = 0
  list.forEach(v => {
    result += v
  })
  console.log(result)
}
main()


import { readFileSync } from 'fs'
function main() {
  const input = readFileSync('/dev/stdin', 'utf8')
  const inputs = input.trim().split('\n')
  const [n, m] = inputs[0].split(' ').map(v => parseInt(v))
  let list = inputs[1].split(' ').map(v => parseInt(v)).sort((a, b) => b - a)
  for (let i = 0; i < m; i++) {
    list[0] = Math.floor(list[0] / 2)
    list = list.sort((a, b) => b - a)
  }
  let result = 0
  list.forEach(v => {
    result += v
  })
  console.log(result)
}
main()


import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')

def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    X = il()
    S = sorted(X)
    l = S[N // 2 - 1]
    r = S[N // 2]
    for x in X:
        if x <= l:
            print(r)
        else:
            print(l)

if __name__ == '__main__':
    main()


N = int(input())
X = list(map(int,input().split()))
Y = sorted(X)

m1=Y[N//2-1]
m2=Y[N//2]

medians = [m2 if x < m2 else m1 for x in X]
print('\n'.join(map(str,medians)))


def getval():
    n = int(input())
    x = list(map(int,input().split()))
    return n,x

def main(n,x):
    y = sorted(x)
    a,b = y[(n-1)//2],y[(n-1)//2+1]
    for i in x:
        if i>a:
            print(a)
        else:
            print(b)

if __name__=="__main__":
    n,x = getval()
    main(n,x)


import statistics
n = int(input())
X = list(map(int, input().split()))
med = sorted(X)[n//2-1]
X_ = sorted(X)
X_.remove(med)
for i in range(n-1):
    if X_[i]>=med:
        med_2 = X_[i]
        break
for i in range(n):
    if X[i]>med:
        print(med)
    elif X[i]==med:
        print(med_2)
    else:
        print(med_2)


import numpy as np

N = int(input())
xl = [int(x) for x in input().split()]

xlsorted = np.sort(xl)
m1 = xlsorted[int(N/2)-1]
m2 = xlsorted[int(N/2)]

for i in range(N):
    if xl[i] <= m1:
        print(m2)
    else:
        print(m1)


#!/usr/bin/env python3

def main():
    n = int(input())
    x = list(map(int, input().split()))
    ans = [0] * n
    for i in range(n):
        fix = x[0:i] + x[i + 1:n]
        fix.sort()
        ans[i] = fix[n // 2 - 1]
    print(*ans, sep='\n')

if __name__ == "__main__":
    main()


import java.io.*;
import java.util.*;

class Main {
    public static void main(String args[]) throws IOException {
        Scan sc = new Scan();
        int n = sc.scanInt();
        int[] arr = new int[n];
        int[] srt = new int[n];
        for(int i = 0; i < n; ++i){
            arr[i] = sc.scanInt();
            srt[i] = arr[i];
        }
        Arrays.sort(srt);
        int mid = n/2;
        int midVal = srt[mid];
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; ++i){
            int val = arr[i];
            if(val < midVal){
                sb.append(midVal).append('\n');
            }
            else
                sb.append(srt[mid-1]).append('\n');
        }
        System.out.println(sb);
    }
}

class Scan
{
    private byte[] buf=new byte[1024];
    private int index;
    private InputStream in;
    private int total;
    public Scan()
    {
        in=System.in;
    }
    public int scan()throws IOException
    {
        if(total<0)
        throw new InputMismatchException();
        if(index>=total)
        {
            index=0;
            total=in.read(buf);
            if(total<=0)
            return -1;
        }
        return buf[index++];
    }
    public int scanInt()throws IOException
    {
        int integer=0;
        int n=scan();
        while(isWhiteSpace(n))
        n=scan();
        int neg=1;
        if(n=='-')
        {
            neg=-1;
            n=scan();
        }
        while(!isWhiteSpace(n))
        {
            if(n>='0'&&n<='9')
            {
                integer*=10;
                integer+=n-'0';
                n=scan();
            }
            else throw new InputMismatchException();
        }
        return neg*integer;
    }
    public long scanLong() throws IOException {
        long integer=0;
        int n=scan();
        while(isWhiteSpace(n))
        n=scan();
        int neg=1;
        if(n=='-')
        {
            neg=-1;
            n=scan();
        }
        while(!isWhiteSpace(n))
        {
            if(n>='0'&&n<='9')
            {
                integer*=10;
                integer+=n-'0';
                n=scan();
            }
            else throw new InputMismatchException();
        }
        return neg*integer;
    }
    public double scanDouble()throws IOException
    {
        double doub=0;
        int n=scan();
        while(isWhiteSpace(n))
        n=scan();
        int neg=1;
        if(n=='-')
        {
            neg=-1;
            n=scan();
        }
        while(!isWhiteSpace(n)&&n!='.')
        {
            if(n>='0'&&n<='9')
            {
                doub*=10;
                doub+=n-'0';
                n=scan();
            }
            else throw new InputMismatchException();
        }
        if(n=='.')
        {
            n=scan();
            double temp=1;
            while(!isWhiteSpace(n))
            {
                if(n>='0'&&n<='9')
                {
                    temp/=10;
                    doub+=(n-'0')*temp;
                    n=scan();
                }
                else throw new InputMismatchException();
            }
        }
        return doub*neg;
    }
    public String scanString()throws IOException
    {
        StringBuilder sb=new StringBuilder();
        int n=scan();
        while(isWhiteSpace(n))
        n=scan();
        while(!isWhiteSpace(n))
        {
            sb.append((char)n);
            n=scan();
        }
        return sb.toString();
    }
    private boolean isWhiteSpace(int n)
    {
        if(n==' '||n=='\n'||n=='\r'||n=='\t'||n==-1)
        return true;
        return false;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.lang.Character.Subset;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.time.temporal.ValueRange;
import java.util.AbstractMap;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import java.util.Stack;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.concurrent.ForkJoinPool;

import static java.util.Comparator.*;

public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyInput in = new MyInput(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        Solver solver = new Solver(in, out);
        solver.solve();

        out.close();
    }

    // ======================================================================
    static class Solver {
    	MyInput in;
    	PrintWriter out;
        public Solver(MyInput in, PrintWriter out) {
        	this.in = in;
        	this.out = out;
        }

        // -----------------------------------------
        public void solve() {
        	int N = ni();
        	int[] X = ndi(N);
        	int[] wk = Arrays.copyOf(X, X.length);
        	Arrays.sort(wk);
        	int l = wk[N/2-1];
        	int r = wk[N/2];
        	for (int i = 0; i < N; i++) {
				if(X[i] < r)	prn(r);
				else			prn(l);
			}
    	}

        // -----------------------------------------
        // Integer のキーに対して、Integer のカウントを管理する（カウントを足したり、引いたりする）
        // キーの最大、最小の取得、データの追加、削除も O(long(N)) で処理できる
        //
        static class MapCounter {
        	private TreeMap<Integer, Integer> map;
        	// 昇順のマップ
        	public MapCounter() {
        		map = new TreeMap<>();
        	}
        	// reverse = tree なら降順のマップ
        	public MapCounter(boolean reverse) {
        		if(reverse) {
        			map = new TreeMap<Integer, Integer>(Collections.reverseOrder());
        		} else {
            		map = new TreeMap<>();
        		}
        	}
        	// キーを追加する（キーが存在すれば、カウントに１足す）
        	public void add(Integer key) {
        		add(key, 1);
        	}
           	public void add(Integer key, int cnt) {
           		Integer val = map.get(key);
        		if(val == null) {
        			map.put(key, cnt);
        		} else {
        			map.put(key,  val + cnt);
        		}
        	}
        	// キーを消す（キーが存在すれば、カウントを１減らす）
        	public void remove(Integer key) {
        		sub(key, 1, false);
        	}
           	// キーのカウントを減らす
        	public void sub(Integer key) {
        		sub(key, 1);
        	}
        	// キーのカウントから値を引く（マイナスのカウントを許す）
        	public void sub(Integer key, int cnt) {
        		sub(key, cnt, true);
        	}
        	// キーのカウントから値を引く
        	//  →　マイナスを許可しない場合で、カウントがマイナスになったら消す
           	public void sub(Integer key, int cnt, boolean minus) {
        		Integer val = map.get(key);
        		if(val == null) {
        			if(minus) {
        				map.put(key, -cnt);				// カウントのマイナスを許す
        			}
        		} else if(val > cnt || minus){
       				map.put(key, val - cnt);
        		} else {
        			map.remove(key);
        		}
        	}
           	// キーのカウントを設定する
           	public void set(Integer key, int cnt) {
    			map.put(key, cnt);
        	}
           	// キーのカウントを取得する（なければ　ＮＵＬＬを返す）
        	public Integer getCountwithNull(Integer key) {
        		return map.get(key);
        	}
        	// キーのカウントを取得する（なければ　０　を返す）
        	public Integer getCount(Integer key) {
        		Integer val = map.get(key);
        		if(val == null)		return 0;
        		else 				return val;
        	}
        	public Set<Integer> getKey() {
        		return map.keySet();
        	}
        	// 登録されているキーの数を返す
        	public int getKeyCount() {
        		return map.keySet().size();
        	}
        	// 先頭キーを返す
        	public Integer getFirstKey() {
        		return map.firstKey();
        	}
        	// 最終キーを返す
        	public Integer getLastKey() {
        		return map.lastKey();
        	}
        	// マップの初期化
        	public void clear() {
        		map.clear();
        	}
       }
        // -----------------------------------------
        // 配列のバイナリーサーチ　１
        boolean isRightMin(int[] a, boolean f, int index, int key) {
    	    if (f && a[index] >= key)		return true;		// 以上
    	    else if (!f && a[index] > key)	return true;		// より大きい
    	    else 							return false;
    	}
    	// 配列 a の中で key 以上（f=true)または、より大きく（f=false)、一番小さい値を返す
    	int binarySearchRightMin(int[] a, boolean f, int key) {
    	    int ng = -1; 				//「index = 0」が条件を満たすこともあるので、初期値は -1
    	    int ok = (int)a.length; 	// 「index = a.length-1」が条件を満たさないこともあるので、初期値は a.length()

    	    /* ok と ng のどちらが大きいかわからないことを考慮 */
    	    while (Math.abs(ok - ng) > 1) {
    	        int mid = (ok + ng) / 2;

    	        if (isRightMin(a, f, mid, key))	ok = mid;	// 下半分を対象とする
    	        else 							ng = mid;	// 上半分を対象とする
    	    }
    	    return ok;		// ←　ここで返すのは　isOK() が true の時にセットする方（ok / ng)
    	}
        // -----------------------------------------
        // 配列のバイナリーサーチ　２
        boolean isLeftMax(int[] a, boolean f, int index, int key) {
    	    if (f && a[index] <= key)		return true;		// 以下
    	    else if (!f && a[index] < key)	return true;		// より小さい
    	    else 							return false;
    	}
    	// 配列 a の中で key 以下（f=true)または、より小さい（f=false)、一番大きい値を返す
    	int binarySearchLeftMax(int[] a, boolean f, int key) {
    	    int ng = -1; 				//「index = 0」が条件を満たすこともあるので、初期値は -1
    	    int ok = (int)a.length; 	// 「index = a.length-1」が条件を満たさないこともあるので、初期値は a.length()

    	    /* ok と ng のどちらが大きいかわからないことを考慮 */
    	    while (Math.abs(ok - ng) > 1) {
    	        int mid = (ok + ng) / 2;

    	        if (isLeftMax(a, f, mid, key))	ng = mid;	// 上半分を対象とする
    	        else 							ok = mid;	// 下半分を対象とする
    	    }
    	    return ng;		// ←　ここで返すのは　isOK() が true の時にセットする方（ok / ng)
    	}

        // -----------------------------------------
    	// オイラーツアー（部分木対応）　　　→　　工事中
    	static class EulerTour {
    		Graph g;
    		List<Integer> euler_tour = new ArrayList<>();
    		int[] begin, end;
    		int k = 0, root = 0;

    		void dfs(int v,int p, PrintWriter out) {
    			out.println("v = " + v + "  p = " + p);
    			begin[v] = k;
    			euler_tour.add(v);
    			k++;
    			if(!g.contains(v)) {
    				return;
    			}
    			for(int i : g.get(v)) {
    				if(i != p) {
    					dfs(i, v, out);
    					euler_tour.add(v);
    					k++;
    				}
    			}
    			end[v]=k;
    		}
    		// 初期化
    		public void init(int p_cnt, int root, Graph g, PrintWriter out) {
    			begin = new int[p_cnt + 1];
    			end = new int[p_cnt + 1];
    			this.root = root;
    			this.g = g;
    			dfs(root, -1, out);
    		}
    		// 部分木の頂点を渡すと、オイラーツアーの部分木を返す
    		public List getPartTour(int v) {
    			return euler_tour.subList(begin[v], end[v]);
    		}
    		// 部分木の頂点を渡すと、頂点のリストを返す
    		public List<Integer> getPartList(int v) {
    			Set<Integer> set = new TreeSet<>();
				set.addAll(getPartTour(v));
				List<Integer> ans = new ArrayList<>();
				for(Integer p : set) {
					ans.add(p);
				}
				return ans;
    		}
    	}

        // -----------------------------------------
        // 重みなし　グラフのリンクリスト
        class Graph {
        	// 頂点に紐づく頂点のリスト
            private Map<Integer, List<Integer>> data = new HashMap<Integer, List<Integer>>();
//            // 全ての頂点のセット
//            private Set<Integer> point = new TreeSet<>();
            // 頂点と頂点の繋がりを追加する
            void add(int from, int to) {
            	List<Integer> list = data.get(from);
            	if(list == null) {
            		list = new ArrayList<Integer>();
            		data.put(from, list);
            	}
            	list.add(to);
//            	point.add(from);
//            	point.add(to);
            }
            // 始点から終点が繋がっていれば切る
            void del(int from, int to) {
            	List<Integer> list = data.get(from);
            	if(list == null) {
            		return;
            	}
            	if(list.contains(to)) {
            		list.remove((Object)to);
            	}
            }
            // 指定された頂点に紐づく、頂点のリストを返す
            List<Integer> get(int key) {
            	return data.get(key);
            }
            // 頂点 key が登録されているか？
            boolean contains(int key) {
            	return data.containsKey(key);
            }

            //　頂点のセットを返す
            Set<Integer> keySet() {
            	return data.keySet();
            }
            // 頂点　key_1 と 頂点　key_2 が　直接　つながっていれば　true を返す
            boolean isConnect(int key_1, int key_2) {
            	List<Integer> list = data.get(key_1);
            	if(list == null)	return false;
            	else 				return list.contains(key_2);
            }
            // 指定された頂点から、すべての頂点への距離を返す(DFS O(N)）　→　返り値が　終点と距離のペア　のリスト
            List<PP> distList(int key) {
            	List<PP> dist = new ArrayList<>();		// 頂点と距離のペアのリスト
            	Set<Integer> mark = new HashSet<>();	// 処理したら入れる
    			Stack<PP> stack = new Stack<>();		// スタックの宣言
    			stack.push(new PP(key, 0));				// スタートをスタックに保存
    			while(!stack.isEmpty()) {
    				PP wk = stack.pop();				// スタックから次の頂点を取得
    				int pp = wk.getKey();
    				int dd = wk.getVal();
    				mark.add(pp);						// 通過マーク
        			dist.add(new PP(pp, dd));			// 距離を登録
    				List<Integer> list = get(pp);		// つながっている頂点のリストを取得
    				for(int next : list) {
    					if(mark.contains(next))	continue;
    					stack.push(new PP(next, dd + 1));
    				}
    			}
    			return dist;
            }
            // 指定された頂点から、すべての頂点への距離を返す(DFS O(N)）	→　返り値は配列
            int[] distV(int key) {
            	int[] dist = new int[data.keySet().size()+1];		// [頂点] = 距離
            	Arrays.fill(dist, -1);					// 届かない場合　-1
            	Set<Integer> mark = new HashSet<>();	// 処理したら入れる
    			Stack<PP> stack = new Stack<>();		// スタックの宣言
    			stack.push(new PP(key, 0));				// スタートをスタックに保存
    			while(!stack.isEmpty()) {
    				PP wk = stack.pop();				// スタックから次の頂点を取得
    				int pp = wk.getKey();
    				int dd = wk.getVal();
    				mark.add(pp);						// 通過マーク
    				dist[pp] = dd;						// 距離を登録
    				List<Integer> list = get(pp);		// つながっている頂点のリストを取得
    				for(int next : list) {
    					if(mark.contains(next))	continue;
    					stack.push(new PP(next, dd + 1));
    				}
    			}
    			return dist;
            }
        	Map<Integer, Integer> mapCnt = new HashMap<>();		// 項番（何番目に訪れたか）
        	Map<Integer, Integer> mapLow = new HashMap<>();		// 初期値は項番、つながっている先の項番が小さければコピーする
																// mapCnt > mapLow なら閉路に含まれる頂点
        	Set<Integer> mark = new HashSet<>();				// 処理したら入れる
        	int number;
        	// mapCnt, mapLow を設定する
            int bridgeDfs(int now, int pre) {
//            	prn("bridgeDfs  now = " + now + " number = " + number);
            	mark.add(now);
            	mapCnt.put(now, number);
            	mapLow.put(now, number);
            	int low;
            	for(int next : get(now)) {
            		if(next == pre)		continue;
            		if(mark.contains(next)) {
            			if(mapLow.get(now) > mapLow.get(next)) {
//            				prn("  mapLow[" + now + "] = " + mapLow.get(now)
//            						+ " > mapLow[" + next + "] = " + mapLow.get(next));
            				mapLow.put(now, mapLow.get(next));
            			}
            			continue;
            		}
            		number++;
            		low = bridgeDfs(next, now);
        			if(mapLow.get(now) > low) {
        				mapLow.put(now, low);
        			}
            	}
            	return mapLow.get(now);
            }
            // 橋の数を返す  先頭の頂点番号を引数とする
            int bridgeCnt(int start) {
            	mapCnt.clear();
            	mapLow.clear();
            	mark.clear();
            	number = 0;
            	bridgeDfs(start, start);
            	int ans = 0;
            	for(int key : mapCnt.keySet()) {
            		if(mapCnt.get(key) == mapLow.get(key)) {
            			ans++;
            		}
            	}
            	return ans - 1;
            }
            // ダンプ
            void dump(PrintWriter out) {
            	for(int key : data.keySet()) {
            		out.print(key + " : ");
            		for(int val : data.get(key)) {
            			out.print(val + " ");
            		}
            		out.println("");
            	}
            }
        }
        // -----------------------------------------
        // 重さを持ったグラフのリンクリスト
        static class GraphWith {
        	// キーに紐づくリストに、頂点番号と重さのペアを持つ
            private Map<Integer, List<PP>> data = new HashMap<Integer, List<PP>>();
            // 指定された頂点に紐づく、頂点と重さのペアを追加する
            void add(int key, PP p) {
            	List<PP> list = data.get(key);
            	if(list == null) {
            		list = new ArrayList<PP>();
            		data.put(key, list);
            	}
            	list.add(p);
            }
            // 頂点に紐づく、頂点と重さのペアのリストを返す
            List<PP> get(int key) {
            	return data.get(key);
            }
            // 頂点 key が登録されているか？
            boolean contains(int key) {
            	return data.containsKey(key);
            }

            //　頂点のセットを返す
            Set<Integer> keySet() {
            	return data.keySet();
            }
            // 頂点　key_1 と 頂点　key_2 が　直接　つながっていれば　true を返す
            boolean isConnect(int key_1, int key_2) {
            	List<PP> list = data.get(key_1);
            	if(list == null)	return false;
            	boolean ans = false;
            	for(PP p : list) {
            		if(p.getKey() == key_2) {
            			ans = true;
            			break;
            		}
            	}
            	return ans;
            }
            // 頂点　key_1 と 頂点　key_2 　の距離を返す（つながっていなければ　Integer.MAX_VALUE)
            int distance(int key_1, int key_2) {
            	Set<Integer> mark = new HashSet<>();	// 処理したら入れる
    			Stack<PP> stack = new Stack<>();		// スタックの宣言
    			stack.push(new PP(key_1, 0));			// スタートをスタックに保存
    			PP wk;
    			int key, val;
    			List<PP> list;
    			while(!stack.isEmpty()) {
    				wk = stack.pop();					// スタックから次の頂点を取得
    				key = wk.getKey();
    				val = wk.getVal();
    				mark.add(key);						// 通過マーク
    				if(key == key_2)	return val;

    				list = get(key);					// つながっている頂点のリストを取得
    				if(list == null)	continue;
    				for(PP pp : list) {
    					if(mark.contains(pp.getKey()))	continue;
    					stack.push(new PP(pp.getKey(), val + pp.getVal()));
    				}
    			}
    			return Integer.MAX_VALUE;
            }
        }
        // -----------------------------------------
        // 重みなし　グラフのリンクリスト(Long)
        static class GraphLong {
            private Map<Long, List<Long>> G = new HashMap<Long, List<Long>>();
            void add(long key, long value) {
            	List<Long> list = G.get(key);
            	if(list == null) {
            		list = new ArrayList<Long>();
            		G.put(key, list);
            	}
            	list.add(value);
            }
            List<Long> get(long key) {
            	return G.get(key);
            }
        }
        // -----------------------------------------
        // 重さを持ったグラフのリンクリスト(Long)
        static class GraphLongWith {
            private Map<Long, List<PPL>> G = new HashMap<Long, List<PPL>>();
            void add(long key, PPL p) {
            	List<PPL> list = G.get(key);
            	if(list == null) {
            		list = new ArrayList<PPL>();
            		G.put(key, list);
            	}
            	list.add(p);
            }
            List<PPL> get(long key) {
            	return G.get(key);
            }
        }
        // -----------------------------------------

        void prn(String s) {
        	out.println(s);
        }
        void prn(int i) {
        	out.println(i);
        }
        void prn(long i) {
        	out.println(i);
        }
        void prr(String s) {
        	out.print(s);
        }
        int ni() {
        	return in.nextInt();
        }
        long nl() {
        	return in.nextLong();
        }
        double nd() {
        	return in.nextDouble();
        }
        String ns() {
        	return in.nextString();
        }
        int[] ndi(int n) {
        	int[] ans = new int[n];
        	for(int i=0; i < n; i++) {
        		ans[i] = ni();
        	}
        	return ans;
        }
        long[] ndl(int n) {
        	long[] ans = new long[n];
        	for(int i=0; i < n; i++) {
        		ans[i] = nl();
        	}
        	return ans;
        }
        double[] ndd(int n) {
        	double[] ans = new double[n];
        	for(int i=0; i < n; i++) {
        		ans[i] = nd();
        	}
        	return ans;
        }
        String[] nds(int n) {
        	String[] ans = new String[n];
        	for(int i=0; i < n; i++) {
        		ans[i] = ns();
        	}
        	return ans;
        }
        int[][] nddi(int n, int m) {
        	int[][] ans = new int[n][m];
        	for(int i=0; i < n; i++) {
            	for(int j=0; j < m; j++) {
            		ans[i][j] = ni();
            	}
        	}
        	return ans;
        }
        long[][] nddl(int n, int m) {
        	long[][] ans = new long[n][m];
        	for(int i=0; i < n; i++) {
            	for(int j=0; j < m; j++) {
            		ans[i][j] = nl();
            	}
        	}
        	return ans;
        }
    }
    // Set に入れるなら　PPKEY　を使う！
    static class PP{
    	public int key, val;
    	public PP(int key, int val) {
    		this.key = key;
    		this.val = val;
    	}
		public int getKey() {
			return key;
		}
		public void setKey(int key) {
			this.key = key;
		}
		public int getVal() {
			return val;
		}
		public void setVal(int val) {
			this.val = val;
		}
    }
    static class PPP{
    	public int key, val1, val2;
    	public PPP(int key, int val1, int val2) {
    		this.key = key;
    		this.val1 = val1;
    		this.val2 = val2;
    	}
		public int getKey() {
			return key;
		}
		public void setKey(int key) {
			this.key = key;
		}
		public int getVal1() {
			return val1;
		}
		public void setVal1(int val1) {
			this.val1 = val1;
		}
		public int getVal2() {
			return val2;
		}
		public void setVal2(int val2) {
			this.val2 = val2;
		}
    }
    static class PPL {
    	public long key, val;
    	public PPL(long key, long val) {
    		this.key = key;
    		this.val = val;
    	}
		public long getKey() {
			return key;
		}
		public void setKey(long key) {
			this.key = key;
		}
		public long getVal() {
			return val;
		}
		public void setVal(long val) {
			this.val = val;
		}
    }
    static class PPDL {
    	public long key;
    	public long[] val;
    	public PPDL(long key, long[] val) {
    		this.key = key;
    		this.val = val;
    	}
		public long getKey() {
			return key;
		}
		public void setKey(long key) {
			this.key = key;
		}
		public long[] getVal() {
			return val;
		}
		public void setVal(long[] val) {
			this.val = val;
		}
		public void dump(PrintWriter out) {
			out.print("key = " + key + "  val ");
			for(int i=0; i < val.length; i++) {
				out.print("[" + val[i] + "] ");
			}
			out.println("");
		}
    }
    // HashMap のキーに使う　→　Set に入れるのもこれ（PPでは値での比較が行われない）
    static final class PPKEY {
    	private final int key, val;
    	public PPKEY(int key, int val) {
    		this.key = key;
    		this.val = val;
    	}
		public int getKey() {
			return key;
		}
		public int getVal() {
			return val;
		}
	    @Override
	    public boolean equals(Object obj) {
	        if (obj instanceof PPKEY) {
	        	PPKEY dest = (PPKEY) obj;
	            return this.key == dest.key && this.val == dest.val;
	        } else {
	            return false;
	        }
	    }
	    @Override
	    public int hashCode() {
	        return Objects.hash(key, val);
	    }
    }
    // HashMap のキーに使う　→　Set に入れるのもこれ（PPでは値での比較が行われない）
    static final class PPLKEY{
    	private final long key, val;
    	public PPLKEY(long key, long val) {
    		this.key = key;
    		this.val = val;
    	}
		public long getKey() {
			return key;
		}
		public long getVal() {
			return val;
		}
	    @Override
	    public boolean equals(Object obj) {
	        if (obj instanceof PPKEY) {
	        	PPKEY dest = (PPKEY) obj;
	            return this.key == dest.key && this.val == dest.val;
	        } else {
	            return false;
	        }
	    }
	    @Override
	    public int hashCode() {
	        return Objects.hash(key, val);
	    }
    }
    // ======================================================================
    static class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {
        /** serialVersionUID. */
        private static final long serialVersionUID = 6411527075103472113L;

        public Pair(final K key, final V value) {
            super(key, value);
        }
     }
    static class MyInput {
        private final BufferedReader in;
        private static int pos;
        private static int readLen;
        private static final char[] buffer = new char[1024 * 8];
        private static char[] str = new char[500 * 8 * 2];
        private static boolean[] isDigit = new boolean[256];
        private static boolean[] isSpace = new boolean[256];
        private static boolean[] isLineSep = new boolean[256];

        static {
            for (int i = 0; i < 10; i++) {
                isDigit['0' + i] = true;
            }
            isDigit['-'] = true;
            isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true;
            isLineSep['\r'] = isLineSep['\n'] = true;
        }

        public MyInput(InputStream is) {
            in = new BufferedReader(new InputStreamReader(is));
        }

        public int read() {
            if (pos >= readLen) {
                pos = 0;
                try {
                    readLen = in.read(buffer);
                } catch (IOException e) {
                    throw new RuntimeException();
                }
                if (readLen <= 0) {
                    throw new MyInput.EndOfFileRuntimeException();
                }
            }
            return buffer[pos++];
        }

        public int nextInt() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            int ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++) ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public long nextLong() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            long ret = 0L;
            if (str[0] == '-') {
                i = 1;
            }
            for (; i < len; i++) ret = ret * 10 + str[i] - '0';
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

        public double nextDouble() {
            int len = 0;
            str[len++] = nextChar();
            len = reads(len, isSpace);
            int i = 0;
            double ret = 0;
            if (str[0] == '-') {
                i = 1;
            }
            int cnt = 0;
            for (; i < len; i++) {
            	if(str[i] == '.') {
            		cnt = 10;
            		continue;
            	}
            	if(cnt == 0) {
            		ret = ret * 10 + str[i] - '0';
            	} else {
            		ret = ret + ((double)(str[i] - '0') / cnt);
            		cnt *= 10;
            	}
            }
            if (str[0] == '-') {
                ret = -ret;
            }
            return ret;
        }

       public String nextString() {
        	String ret = new String(nextDChar()).trim();
            return ret;
        }

        public char[] nextDChar() {
            int len = 0;
            len = reads(len, isSpace);
            char[] ret = new char[len + 1];
            for (int i=0; i < len; i++)		ret[i] = str[i];
            ret[len] = 0x00;
            return ret;
        }

        public char nextChar() {
            while (true) {
                final int c = read();
                if (!isSpace[c]) {
                    return (char) c;
                }
            }
        }

        int reads(int len, boolean[] accept) {
            try {
                while (true) {
                    final int c = read();
                    if (accept[c]) {
                        break;
                    }
                    if (str.length == len) {
                        char[] rep = new char[str.length * 3 / 2];
                        System.arraycopy(str, 0, rep, 0, str.length);
                        str = rep;
                    }
                    str[len++] = (char) c;
                }
            } catch (MyInput.EndOfFileRuntimeException e) {
            }
            return len;
        }

        static class EndOfFileRuntimeException extends RuntimeException {
        }
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.Closeable;
import java.io.IOException;
import java.util.NoSuchElementException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author HBonsai
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CManyMedians solver = new CManyMedians();
        solver.solve(1, in, out);
        out.close();
    }

    static class CManyMedians {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int N = in.nextInt();
            int[] X = in.nextIntArray(N);
            int[] Y = X.clone();
            Arrays.sort(Y);
            StringBuilder ans = new StringBuilder();
            for (int i = 0; i < N; i++) {
                if (Y[N / 2 - 1] >= X[i]) ans.append(Y[N / 2]).append("\n");
                else ans.append(Y[N / 2 - 1]).append("\n");
            }
            out.println(ans);
        }

    }

    static class FastScanner implements Closeable {
        private final InputStream in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;

        public FastScanner(InputStream in) {
            this.in = in;
        }

        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }

        private int readByte() {
            if (hasNextByte()) return buffer[ptr++];
            else return -1;
        }

        private static boolean isPrintableChar(int c) {
            return 33 <= c && c <= 126;
        }

        public boolean hasNext() {
            while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
            return hasNextByte();
        }

        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while (true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }

        public int[] nextIntArray(final int n) {
            final int[] res = new int[n];
            for (int i = 0; i < n; i++) {
                res[i] = nextInt();
            }
            return res;
        }

        public void close() {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }
}


import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner in = new Scanner(System.in)) {
            int N = in.nextInt();
            int[] X = new int[N];
            for (int i = 0; i < N; i++) {
                X[i] = in.nextInt();
            }

            IntListSorted list = new IntListSorted(N);
            for (int i = 0; i < N; i++) {
                list.add(X[i]);
            }

            int[] medians = new int[N];
            for (int i = 0; i < N; i++) {
                list.removeValue(X[i]);
                medians[i] = list.get((N - 2) / 2);
                list.add(X[i]);
            }

            for (int i = 0; i < N; i++) {
                System.out.println(medians[i]);
            }
        }
    }
}

class IntListSorted {
    private static final int EMPTY = -1;
    private int[] values;
    private int size;

    public IntListSorted(int capacity) {
        values = new int[capacity];
        clear();
    }

    public void clear() {
        size = 0;
    }

    public int size() {
        return size;
    }

    public boolean isEmpty() {
        return size() <= 0;
    }

    public boolean contains(int value) {
        return indexOf(value) != EMPTY;
    }

    public boolean add(int value) {
        values[size++] = value;
        for (int i = size - 1; i >= 1; i--) {
            if (values[i - 1] <= values[i]) {
                break;
            }
            swap(values, i - 1, i);
        }
        return true;
    }

    private void swap(int[] values, int i, int j) {
        int swap = values[i];
        values[i] = values[j];
        values[j] = swap;
    }

    public boolean removeValue(int value) {
        int index = indexOf(value);
        if (index == EMPTY) {
            return false;
        }
        remove(index);
        return true;
    }

    public int remove(int index) {
        int value = values[index];
        for (int i = index; i + 1 < size; i++) {
            values[i] = values[i + 1];
        }
        size--;
        return value;
    }

    public int get(int index) {
        return values[index];
    }

    public void add(int index, int value) {
        assert index <= size;
        for (int i = size - 1; i >= index; i--) {
            values[i + 1] = values[i];
        }
        size++;
        values[index] = value;
    }

    public int indexOf(int value) {
        int index = Arrays.binarySearch(values, 0, size, value);
        if (index < 0) {
            return EMPTY;
        }
        int index0 = index;
        for (;;) {
            index = Arrays.binarySearch(values, 0, index0, value);
            if (index < 0) {
                break;
            }
            index0 = index;
        }
        return index0;
    }

}


import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> x = new ArrayList<>();
        ArrayList<Integer> xx = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int tmp = sc.nextInt();
            x.add(tmp);
            xx.add(tmp);
        }
        Collections.sort(xx);
        int r = xx.get(n / 2 - 1);
        int l = xx.get(n / 2);
        for (int i = 0; i < n; i++) {
            int tmp = x.get(i);
            int tmp3 = xx.indexOf(Integer.valueOf(tmp));
            int tmp4 = 0;
            if(tmp3 <= (n - 1) / 2) {
                tmp4 = l;
            } else if (tmp3 > (n - 1) / 2) {
                tmp4 = r;
            }
            System.out.println(tmp4);
        }
    }
}


import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> x = new ArrayList<>();
        ArrayList<Integer> xx = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            int tmp = sc.nextInt();
            x.add(tmp);
            xx.add(tmp);
        }
        Collections.sort(xx);
        for (int i = 0; i < n; i++) {
            int tmp = x.get(i);
            int tmp3 = xx.indexOf(Integer.valueOf(tmp));
            int tmp4 = 0;
            if(tmp3 <= (n - 1) / 2) {
                tmp4 = xx.get(((n - 1) / 2) + 1);
            } else if (tmp3 > (n - 1) / 2) {
                tmp4 = xx.get((n - 1) / 2);
            }
            System.out.println(tmp4);
        }
    }
}


#include<bits/stdc++.h>
using namespace std;

/* FastIO by rsk0315 (last update: 2018/02/21 00:36) */

namespace FastIn {
    static constexpr size_t BUF_SIZE=1<<17, INT_LEN=24, FLT_LEN=400;
    static char buf[BUF_SIZE|1]={}, *pos=buf, *endbuf=nullptr;
    FILE *fin;

    inline bool rebuffer() {
        // returns true <=> there is at least one unread character
        size_t rest=endbuf-pos;
        if (buf+rest > pos) {
            // buf[:pos] and buf[-pos:] are overlapping, which std::memcpy()
            // causes undefined behavior.
            return true;
        }

        std::memcpy(buf, pos, rest);
        pos = buf;
        size_t len=std::fread(pos+rest, 1, BUF_SIZE-rest, fin);
        *(endbuf = buf + (rest+len)) = 0;

        return *pos;
    }

    inline bool scan(char &in) {
        if ((in = *pos)) {
            ++pos;
            return true;
        }

        return rebuffer() && (in = *pos++);
    }

    inline bool scan(char *in) {
        if ((*in = *pos) == 0) {
            if (rebuffer() && (*in = *pos) == 0) {
                return false;
            }
        }
        ++in;
        while (true) {
            if ((*in = *pos++) == 0) {
                if (rebuffer() && (*in = *pos++) == 0) {
                    return true;
                }
            }
            ++in;
        }
    }

    inline bool scan(double &in) {
        if (pos + FLT_LEN >= endbuf && !rebuffer()) {
            in = 0.0;
            return false;
        }

        char *tmp;
        in = std::strtod(pos, &tmp);
        pos = tmp;
        return true;
    }

    template <class Int>
    inline bool scan(Int &in) {
        in = 0;

        // assume that no redundant whitespace appears
        if (pos + INT_LEN >= endbuf && !rebuffer()) {
            return false;
        }

        if (std::is_signed<Int>::value) {
            if (*pos == '-') {
                in = ~*++pos+'1';
                while (*++pos >= '0') {
                    in = in*10 + ~*pos+'1';
                }
                ++pos;
                return true;
            }
        }

        // assume that numbers are separated by the character whose value is
        // less than '0' (e.g. whitespaces, newlines)
        do {
            in = in*10 + *pos-'0';
        } while (*++pos >= '0');
        ++pos;
        return true;
    }

    inline bool eat() {
        if (*pos > ' ') {
            return true;
        }

        do {
            if (*pos == 0 && !rebuffer()) {
                return false;
            }
        } while (*++pos <= ' ');

        return true;
    }

    inline bool eat(char ch) {
        if (*pos == ch) {
            return true;
        }

        do {
            if (*pos == 0 && !rebuffer()) {
                return false;
            }
        } while (*++pos != ch);

        return true;
    }

    class Scanner {
        bool rebuffer() {
            return FastIn::rebuffer();
        }

    public:
        Scanner(FILE *fin=stdin) {
            FastIn::fin = fin;
            endbuf = pos + std::fread(buf, 1, BUF_SIZE, fin);
        }

        template <class T>
        inline bool scan(T &in) {
            return FastIn::scan(in);
        }

        template <class First, class... Rest>
        inline bool scan(First &in, Rest &...ins) {
            return scan(in) && scan(ins...);
        }
    };
}

namespace FastOut {
    static constexpr size_t BUF_SIZE=1<<17, INT_LEN=24, FLT_LEN=400;
    static constexpr char FLT_FMT[]="%.16f";
    static char buf[BUF_SIZE|1]={}, *pos=buf, *endbuf=pos+BUF_SIZE;
    FILE *fout;

    inline void flush() {
        std::fwrite(buf, 1, pos-buf, fout);
        pos = buf;
    }

    inline void print(const char out) {
        if (pos == endbuf) {
            flush();
        }
        *pos++ = out;
    }

    inline void print(const char *out) {
        size_t len=std::strlen(out);
        if (pos + len >= endbuf) {
            flush();
            if (len >= BUF_SIZE) {
                std::fwrite(out, 1, len, fout);
                return;
            }
        }
        std::memcpy(pos, out, len);
        pos += len;
    }

    inline void print(char *out) {
        size_t len=std::strlen(out);
        if (pos + len >= endbuf) {
            flush();
            if (len >= BUF_SIZE) {
                std::fwrite(out, 1, len, fout);
                return;
            }
        }
        std::memcpy(pos, out, len);
        pos += len;
    }

    template <class Char, size_t Len>
    inline void print(const Char (&out)[Len]) {
        print(&out[0]);
    }

    inline void print(const double out) {
        char minibuf[FLT_LEN];
        size_t len=std::snprintf(minibuf, FLT_LEN, FLT_FMT, out);
        if (pos + len >= endbuf) {
            flush();
        }
        std::memcpy(pos, minibuf, len);
        pos += len;
    }

    inline void print(const bool out) {
        print(out? "true":"false");
    }

    template <class Int>
    inline void print(Int out) {
        static_assert(std::is_integral<Int>::value, "For integers only");

        if (out == 0) {
            if (pos == endbuf) {
                flush();
            }
            *pos++ = '0';
            return;
        }

        char minibuf[INT_LEN], *minipos=minibuf+INT_LEN;
        if (std::is_signed<Int>::value && out < 0) {
            if (pos == endbuf) {
                flush();
            }
            *pos++ = '-';
            if (out == std::numeric_limits<Int>::min() && Int(-1) == ~Int(0)) {
                // In two's complement representation, we could not represent the
                // absolute value of minimum (maximum-magnitude negative) value.
                // Without this branch, we would overflow (undefined behavior) by
                // the value.  If we know the input is never the value, we can
                // remove this branch and save (nanoseconds-order) time.
                switch (sizeof out) {
                    case 1:
                        return (void)(print("128"));
                    case 2:
                        return (void)(print("32768"));
                    case 3:
                        return (void)(print("8388608"));
                    case 4:
                        return (void)(print("2147483648"));
                    case 8:
                        return (void)(print("9223372036854775808"));
                    case 16:
                        return (void)(print("170141183460469231731687303715884105728"));
                    default:
                        // Regardless of the number of its bytes, lowest (decimal) digit
                        // is always eight, but other digits depend on it.
                        *--minipos = '8';
                        out /= -10;
                }
            } else {
                out = -out;
            }
        }

        // We know the division is too slow; we wish we could avoid using them
        // TWICE PER LOOP!  ...Now, we notice that compilers are so smart that
        // can replace it by shift operations...  The division-compatible
        // instructions for unsigned are shorter than ones for signed.
        typename std::make_unsigned<Int>::type out_=out;
        do {
            *--minipos = '0' + out_%10;
            out_ /= 10;
        } while (out_ > 0);

        size_t len=(minibuf+INT_LEN)-minipos;
        if (pos + len >= endbuf) {
            flush();
        }
        std::memcpy(pos, minipos, len);
        pos += len;
    }

    class Printer {
        inline void flush() {
            FastOut::flush();
        }

    public:
        Printer(FILE *fout=stdout) {
            FastOut::fout = fout;
        }

        ~Printer() {
            flush();
        }

        template <class T>
        inline void print(const T out) {
            FastOut::print(out);
        }

        template <class First, class... Rest>
        inline void print(const First &out, const Rest &...outs) {
            FastOut::print(out);
            Printer::print(outs...);
        }

        template <class T>
        inline void println(const T out) {
            FastOut::print(out);
            FastOut::print('\n');
        }
    };
}

int main(){
    FastIn::Scanner in;
    FastOut::Printer out;

    long N;
    in.scan(N);
    deque<long> A(N);
    for(auto& i : A)in.scan(i);

    N >>= 1;

    deque<long> B(A);

    nth_element(begin(A), begin(A) + N - 1, end(A));
    nth_element(begin(A) + N - 1, begin(A) + N, end(A));

    for(const auto i : B)out.println(i >= A[N] ? A[N - 1] : A[N]);

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
void *wmem;
void sortF_L(int N, unsigned A[], void *mem = wmem){
  int bt, i, m, *sz;
  unsigned *arr, c;
  if(N < 256){
    sort(A, A+N);
    return;
  }
  bt = sizeof(unsigned) * 8;
  arr = (unsigned*)mem;
  sz = (int*)(arr+N);
  for(m=0;m<bt;m+=8){
    for(i=0;i<257;i++){
      sz[i] = 0;
    }
    for(i=0;i<N;i++){
      sz[ 1+((A[i]>>m)&255u) ]++;
    }
    for(i=1;i<257;i++){
      sz[i] += sz[i-1];
    }
    for(i=0;i<N;i++){
      c = ((A[i]>>m)&255u);
      arr[sz[c]++] = A[i];
    }
    swap(A, arr);
  }
}
void sortF_L(int N, int A[], void *mem = wmem){
  int *arr, i, x, y, z;
  unsigned *send;
  if(N < 256){
    sort(A, A+N);
    return;
  }
  send = (unsigned*)A;
  sortF_L(N, send, mem);
  if(A[0] < 0 || A[N-1] >= 0){
    return;
  }
  x = 0;
  y = N;
  while(x < y){
    z = (x+y) / 2;
    if(A[z] < 0){
      y = z;
    }
    else{
      x = z+1;
    }
  }
  arr = (int*)mem;
  z = 0;
  for(i=x;i<N;i++){
    arr[z++] = A[i];
  }
  for(i=0;i<x;i++){
    arr[z++] = A[i];
  }
  for(i=0;i<N;i++){
    A[i] = arr[i];
  }
}
void sortF_L(int N, unsigned long long A[], void *mem = wmem){
  int bt, i, m, *sz;
  unsigned c;
  unsigned long long *arr;
  if(N < 512){
    sort(A, A+N);
    return;
  }
  bt = sizeof(unsigned long long) * 8;
  arr = (unsigned long long*)mem;
  sz = (int*)(arr+N);
  for(m=0;m<bt;m+=8){
    for(i=0;i<257;i++){
      sz[i] = 0;
    }
    for(i=0;i<N;i++){
      sz[ 1+((A[i]>>m)&255u) ]++;
    }
    for(i=1;i<257;i++){
      sz[i] += sz[i-1];
    }
    for(i=0;i<N;i++){
      c = ((A[i]>>m)&255u);
      arr[sz[c]++] = A[i];
    }
    swap(A, arr);
  }
}
void sortF_L(int N, long long A[], void *mem = wmem){
  int i, x, y, z;
  long long *arr;
  unsigned long long *send;
  if(N < 512){
    sort(A, A+N);
    return;
  }
  send = (unsigned long long*)A;
  sortF_L(N, send, mem);
  if(A[0] < 0 || A[N-1] >= 0){
    return;
  }
  x = 0;
  y = N;
  while(x < y){
    z = (x+y) / 2;
    if(A[z] < 0){
      y = z;
    }
    else{
      x = z+1;
    }
  }
  arr = (long long*)mem;
  z = 0;
  for(i=x;i<N;i++){
    arr[z++] = A[i];
  }
  for(i=0;i<x;i++){
    arr[z++] = A[i];
  }
  for(i=0;i<N;i++){
    A[i] = arr[i];
  }
}
inline void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
char memarr[96000000];
int N;
int X[200000];
int b[200000];
int main(){
  int i, s, t;
  wmem = memarr;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
      rd(X[Lj4PdHRW]);
    }
  }
  for(i=0;i<N;i++){
    b[i] = X[i];
  }
  sortF_L(N, b);
  s = b[N/2-1];
  t = b[N/2];
  for(i=0;i<N;i++){
    if(X[i] <= s){
      wt_L(t);
      wt_L('\n');
    }
    else{
      wt_L(s);
      wt_L('\n');
    }
  }
  return 0;
}
// cLay varsion 20190721-1

// --- original code ---
// int N, X[2d5];
//
// int b[2d5];
// {
//   int i, s, t;
//   rd(N,X(N));
//
//   rep(i,N) b[i] = X[i];
//   sortF(N, b);
//   s = b[N/2-1];
//   t = b[N/2];
//
//   rep(i,N) wt(if[X[i] <= s, t, s]);
// }


#include <cstdio>
#include <cstring>
#include <algorithm>
#ifdef ONLINE_JUDGE
#define freopen(a, b, c)
#endif

typedef long long int ll;

namespace IPT {
  const int L = 1000000;
  char buf[L], *front=buf, *end=buf;
  char GetChar() {
    if (front == end) {
      end = buf + fread(front = buf, 1, L, stdin);
      if (front == end) return -1;
    }
    return *(front++);
  }
}

template <typename T>
inline void qr(T &x) {
  char ch = IPT::GetChar(), lst = ' ';
  while ((ch > '9') || (ch < '0')) lst = ch, ch=IPT::GetChar();
  while ((ch >= '0') && (ch <= '9')) x = (x << 1) + (x << 3) + (ch ^ 48), ch = IPT::GetChar();
  if (lst == '-') x = -x;
}

namespace OPT {
  char buf[120];
}

template <typename T>
inline void qw(T x, const char aft, const bool pt) {
  if (x < 0) {x = -x, putchar('-');}
  int top=0;
  do {OPT::buf[++top] = static_cast<char>(x % 10 + '0');} while (x /= 10);
  while (top) putchar(OPT::buf[top--]);
  if (pt) putchar(aft);
}

const int maxn = 2000005;

int n, x, y;
int MU[maxn], CU[maxn];

int main() {
  qr(n);
  for (int i = 1; i <= n; ++i) {
    qr(MU[i]);
  }
  memcpy(CU + 1, MU + 1, n * sizeof(int));
  std::sort(MU + 1, MU + 1 + n);
  x = MU[n >> 1]; y = MU[(n >> 1) + 1];
  for (int i = 1; i <= n; ++i) {
    qw((CU[i] <= x) ? y : x, '\n', true);
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define ALL(v) (v).begin(), (v).end()

int main(){
  ll N;  cin >> N;
  VL X(N);
  rep(i,0,N){
    cin >> X[i];
  }
  VL sX(N);
  sX = X;
  sort(ALL(sX));

  rep(i,0,N/2){
    if(sX[N/2] == X[i]) cout << sX[N/2-1] << endl;
    else cout << sX[N/2] << endl;
  }
  rep(i,N/2,N){
    if(sX[N/2-1] == X[i]) cout << sX[N/2] << endl;
    else cout << sX[N/2-1] << endl;
  }
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define ALL(v) (v).begin(), (v).end()

int main(){
  ll N;  cin >> N;
  VL X(N,0);
  rep(i,0,N){
    cin >> X[i];
  }

  rep(i,0,N){
    VL sX = X;
    sX.erase(sX.begin()+i);
    sort(ALL(sX));
    cout << sX[N/2-1] << endl;
  }
  return 0;
}


#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	vector<int> t = a;
	sort(t.begin(), t.end());
	int c = t[n / 2];
	int d = t[n / 2 - 1];
	rep(i, n) {
		if (a[i] == c) cout << d << endl;
		else cout << c << endl;
	}
	return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

static i64 read_int(void){int prev='\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}
static void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}

i32 nth (i32 *a, i32 n, i32 k) {
  i32 p = rand() % n;
  i32 pivot = a[p];
  a[p] = a[0];
  i32 assign = 0;
  i32 l = 1;
  i32 r = n;
  while (l < r) {
    if (a[l] == pivot) {
      l++;
    } else if (a[l] < pivot) {
      a[assign++] = a[l++];
    } else {
      i32 swap = a[--r];
      a[r] = a[l];
      a[l] = swap;
    }
  }
  for (i32 i = assign; i < l; ++i) a[i] = pivot;
  if (assign <= k && k < r) return pivot;
  return k < assign ? nth (a, assign, k) : nth (a + l, n - l, k - l);
}

void run (void) {
  i32 n = read_int();
  i32 *a = (i32 *) calloc (2 * n, sizeof (i32));
  i32 *b = a + n;
  for (i32 i = 0; i < n; ++i) {
    a[i] = b[i] = read_int();
  }
  i32 l = nth (b, n, n / 2 - 1);
  i32 r = 1000000000;
  for (i32 i = n / 2; i < n; ++i) r = r > b[i] ? b[i] : r;
  for (i32 i = 0; i < n; ++i) {
    print_int (a[i] <= l ? r : l);
    putchar ('\n');
  }
}

int main (void) {
  run();
  return 0;
}


#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>
#include<string.h>

typedef int32_t i32;
typedef int64_t i64;

static i64 read_int(void){int prev='\0';int c=getchar();while(!('0'<=c && c<='9')){prev=c;c=getchar();}i64 res=0;while('0'<=c && c<='9'){res=10*res+c-'0';c=getchar();}return prev=='-'?-res:res;}
static void print_int(i64 n){if(n<0){putchar('-');n=-n;}if(n==0){putchar('0');return;}int s[20],len=0;while(n>0){s[len++]=n%10+'0';n/=10;}while(len>0){putchar(s[--len]);}}

typedef i32  radix_type;

#define RADIX_WIDTH 10
const uint32_t radix_type_max = 30;
const uint32_t radix_type_begin = 0;
const uint32_t radix_width = RADIX_WIDTH;
const uint32_t radix_mask = (1 << RADIX_WIDTH) - 1;
#undef RADIX_WIDTH

static inline uint32_t radix_get_bit (radix_type v, uint32_t shift) {
  return v >> shift & radix_mask;
}

void radix_sort (radix_type *a, uint32_t n) {
  radix_type * const array = (radix_type *) calloc (4 * n, sizeof (radix_type));
  radix_type **bucket = (radix_type **) calloc (1 << radix_width, sizeof (radix_type *));
  uint32_t *len = (uint32_t *) calloc (2 << radix_width, sizeof (uint32_t));
  uint32_t *max_len = len + (1 << radix_width);
  for (uint32_t shift = radix_type_begin; shift < radix_type_max; shift += radix_width) {
    radix_type *p = array;
    memset (len, 0, sizeof (uint32_t) << (radix_width + 1));
    for (uint32_t i = 0; i < n; ++i) {
      uint32_t bit = radix_get_bit (a[i], shift);
      if (len[bit] == max_len[bit]) {
	for (uint32_t j = 0; j < len[bit]; ++j) {
	  p[j] = bucket[bit][j];
	}
	max_len[bit] = 2 * max_len[bit] + 1;
	bucket[bit] = p;
	p += max_len[bit];
      }
      bucket[bit][len[bit]++] = a[i];
    }
    for (uint32_t bit = 0, i = 0; bit < (1 << radix_width); ++bit) {
      for (uint32_t j = 0; j < len[bit]; ++j, ++i) {
	a[i] = bucket[bit][j];
      }
    }
  }
  free (array);
  free (bucket);
  free (len);
}

void run (void) {
  i32 n = read_int();
  i32 *a = (i32 *) calloc (2 * n, sizeof (i32));
  i32 *b = a + n;
  for (i32 i = 0; i < n; ++i) {
    a[i] = b[i] = read_int();
  }
  radix_sort (b, n);
  i32 l = b[n / 2 - 1];
  i32 r = b[n / 2];
  for (i32 i = 0; i < n; ++i) {
    print_int (a[i] <= l ? r : l);
    putchar ('\n');
  }
}

int main (void) {
  run();
  return 0;
}


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

void split(int out[], char str[]);
int cmp(const void *p, const void *q);

int main(void) {
  int nums;
  char *tmp;
  int *list, *sorted;
  int rmed, lmed;
  tmp = (char *)malloc(sizeof(char) * 2000001);
  list = (int *)malloc(sizeof(int) * 200001);
  sorted = (int *)malloc(sizeof(int) * 200001);
  int i;
  scanf("%d\n", &nums);
  gets(tmp);
  split(list, tmp);
  memcpy(sorted, list, sizeof(int) * nums);
  qsort(sorted, nums, sizeof(int), cmp); // listをソート
  rmed = sorted[nums / 2];
  lmed = sorted[nums / 2 - 1]; // 正しい
  free(sorted);
  for (i = 0; i < nums; ++i) {
    if (list[i] <= lmed) {
      printf("%d\n", rmed);
    } else {
      printf("%d\n", lmed);
    }
  }
  free(tmp);
  free(list);
  return 0;
}

void split(int out[], char str[]) {
  int i;
  int out_i = 0, tmp_i = 0;
  char tmp[11] = {};
  for (i = 0; ; ++i) {
    if (str[i] == ' ') {
      out[out_i++] = atoi(tmp);
      memset(tmp, '\0', sizeof(tmp));
      tmp_i = 0;
    } else if (str[i] == '\0') {
      out[out_i] = atoi(tmp);
      break;
    } else {
      tmp[tmp_i++] = str[i];
    }
  }
}

int cmp(const void *p, const void *q) {
    return *(int*)p - *(int*)q;
}


#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
int main() {
    int n;
    scanf("%d", &n);

    vector<int> x(n);
    rep(i, n) scanf("%d", &x[i]);

    vector<int> y(x);
    sort(y.begin(), y.end());

    int lo = y[n / 2 - 1];
    int hi = y[n / 2];

    rep(i, n) {
        int ans = (x[i] <= lo) ? hi : lo;
        printf("%d\n", ans);
    }
    return 0;
}


#include<stdio.h>
int a[200000],b[200000],k,n;
void quicksort(int a[],int s,int t){
  if(s<t){
    int i=s,j=t,p=b[a[(s+t)/2]];
    while(1){
      while(b[a[i]]<p)i++;
      while(p<b[a[j]])j--;
      if(i>=j)break;
      a[i]^=a[j]^=a[i]^=a[j];
      i++;j--;
    }
    quicksort(a,s,i-1);quicksort(a,j+1,t);
  }
}
int main(){
  scanf("%d",&n);
  for(k=0;k<n;k++){scanf("%d",&b[k]);a[k]=k;}
  quicksort(a,0,n-1);
  for(k=0;k<n;k++)printf("%d\n",a[k]<n/2?b[a[n/2]]:b[a[n/2-1]]);
}


#include<stdio.h>
void quicksort(int a[],int s,int t){
  if(s<t){
    int i=s,j=t,p=a[(s+t)/2];
    while(1){
      while(a[i]<p)i++;
      while(p<a[j])j--;
      if(i>=j)break;
      a[i]^=a[j]^=a[i]^=a[j];
      i++;j--;
    }
    quicksort(a,s,i-1);quicksort(a,j+1,t);
  }
}
int main(){
  int a[200000],i,n;
  scanf("%d",&n);
  for(i=0;i<n;i++)scanf("%d",&a[i]);
  quicksort(a,0,n-1);
  for(i=0;i<n;i++)printf("%d\n",i<n/2?a[n/2]:a[n/2-1]);
}


Main(myin());
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
function myerr(t){console.error(t);}//standard error
//[no]param
//不明値:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
//8:半角SPで結合　9:改行で結合　0:文字なしで結合
function myconv(i,no){switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}
function Main(input) {
  input = myconv(input,3);
  var N = myconv(input[0],1);
  var list = myconv(input[1],4);
  var sortedList = JSON.parse(JSON.stringify(list));
  sortedList.sort(function(a,b){
  	return a-b;
  });
  var output = new Array(N);
  if(sortedList[N/2-1] == sortedList[N/2]){
    output.fill(sortedList[N/2-1]);
  }else{
    for(var i = 0; i < N; i++){
      if(list[i] <= sortedList[N/2-1]){
         output[i] = sortedList[N/2];
      }else{
        output[i] = sortedList[N/2-1];
      }
    }
  }
  myout(myconv(output,9));
}


'use strict'

function main(input) {

    input = input.split('\n')
    const n = ~~input[0]
    const x = input[1].split(' ').map(v => ~~v)
    const x2 = x.slice(0).sort((a, b) => a - b)

    const mid = x2[n / 2]
    const mid2 = x2[n / 2 - 1]

    let ans = ''
    for (let i = 0; i < n; i++) {
        if (x[i] < mid) ans += mid+'\n'
        else ans += mid2+'\n'

    }

    console.log(ans)
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


'use strict'

function main(s) {

  s = s.split('\n');

  const nums = s[1].split(' ').map(n => Number(n));

  const copy_nums = nums.slice(0);
  copy_nums.sort((a, b) => a - b);

  const med1 = copy_nums[copy_nums.length / 2];
  const med2 = copy_nums[(copy_nums.length / 2) - 1];

  const ans = [];

  for (const n of nums) {
    if (med1 > n)  ans.push(med1);
    if (med1 <= n) ans.push(med2);
  }

  console.log(ans.join('\n'));
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


console.log((args=>{
  const [[N],X] = args.trim().split('\n').map(r=>r.split(' ').map(v=>v|0));
  const _X = [].concat(X).sort((a,b)=>a-b);
  const M1 = _X[N/2-1], M2 = _X[N/2];
  const m = [];
  for ( let i = 0; i < N; i++ ) {
    if ( X[i] <= M1 ) m.push(M1); else m.push(M2);
  }
  return m.join`\n`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


console.log((args=>{
  const [[N],...X] = args.trim().split('\n').map(r=>r.split(' ').map(v=>v|0));
  const _X = [].concat(X).sort((a,b)=>a-b);
  const M1 = _X[N/2-1], M2 = _X[N/2];
  const m = [];
  for ( let i = 0; i < N; i++ ) {
    if ( X[i] < M1 ) m.push(M1); else m.push(M2);
  }
  return m.join`\n`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));


//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = new Date();
  Main();
  var end = new Date() - start;

  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var N = nextInt();
	var list = nextIntArray();
	var check = JSON.parse(JSON.stringify(list));
	check.sort(function(a,b){
		return a - b;
	});
	var output = new Array(N);
	var max1 = check[(N / 2)];
	var max2 = check[N / 2 - 1];
	for(var i = 0; i < N; i++){
		if(max2 == max1){
			output[i] = max1;
		}else{
			if(max1 == list[i]){
				output[i] = max2;
			}else{
				output[i] = max1;
			}
		}
	}
	myout(myconv(output,9));
}