# frozen_string_literal: true

n = gets.to_i
xy = n.times.map { gets.split.map(&:to_i) }

hx = Hash.new(0)
hy = Hash.new(0)

xy.each do |e|
  x = e[0]
  y = e[1]
  hx[x] += 1
  hy[y] += 1
end
sxy = xy.sort
count = 0
sxy.each do |e|
  x = e[0]
  y = e[1]
  vx = hx[x]
  vy = hy[y]
  next if vx == 1 || vy == 1

  count += (vx - 1) * (vy - 1)
end
puts count
