struct Scanner { private var elements = [String]() private var index = 0 mutating func peek() -> String { while elements.count == index { elements = readLine()!.split(separator: " ").map(String.init) index = 0 } return elements[index] } mutating func next() -> String { let value = peek() index += 1 return value } mutating func nextInt() -> Int { return Int(next())! } mutating func nextDouble() -> Double { return Double(next())! } } var scanner = Scanner() let N = scanner.nextInt() var P = [(x: Int, y: Int)]() for _ in 0 ..< N { let x = scanner.nextInt() let y = scanner.nextInt() P.append((x: x, y: y)) } var events = [(t: Int, i: Int, j: Int)]() for i in 0 ..< N { for j in i + 1 ..< N { let dx = P[j].x - P[i].x let dy = P[j].y - P[i].y events.append((t: dx * dx + dy * dy, i: i, j: j)) } } events.sort { $0.t < $1.t } var alive = [Bool](repeating: true, count: N) var answer = 0 for (_, i, j) in events where alive[i] && alive[j] { if i == 0 { answer += 1 } else { alive[i] = false } alive[j] = false } print(answer)