local mce, mfl, msq, mmi, mma = math.ceil, math.floor, math.sqrt, math.min, math.max
local n = io.read("*n")
local t = {}
for i = 1, n do
  t[i] = {}
  t[i].x, t[i].y = io.read("*n", "*n")
end
table.sort(t, function(v, w)
  if v.x == w.x then
    return v.y < w.y
  else
    return v.x < w.x
  end
end
)

local function getcost(p, q)
  local cost = 0
  if p == 0 then
    local done = 0
    local donelist = {}
    for i = 1, n do donelist[i] = false end
    while done < n do
      cost = cost + 1
      local idx = 1
      for i = 1, n do
        if donelist[i] then idx = i break end
      end
      donelist[idx] = true
      done = done + 1
      local nx, ny = t[idx].x, t[idx].y + q
      local rep = true
      while rep do
        rep = false
        for i = 1, n do
          if nx == t[i].x and ny == t[i].y and not donelist[i] then
            ny = ny + q
            donelist[i] = true
            done = done + 1
            rep = true
          end
        end
      end
    end
  else
    local done = 0
    local donelist = {}
    for i = 1, n do donelist[i] = false end
    while done < n do
      cost = cost + 1
      local idx = 1
      for i = 1, n do
        if donelist[i] then idx = i break end
      end
      donelist[idx] = true
      done = done + 1
      local nx, ny = t[idx].x + p, t[idx].y + q
      for i = idx + 1, n do
        if nx == t[i].x and ny == t[i].y then
          nx, ny = nx + p, ny + q
          donelist[i] = true
          done = done + 1
        end
      end
    end
  end
  return cost
end

local ret = 50
for i = 1, n - 1 do
  for j = i + 1, n do
    local c = getcost(t[j].x - t[i].x, t[j].y - t[i].y)
    ret = mmi(ret, c)
  end
end
print(ret)
