H, W, M = gets.chomp.split.map(&:to_i)

BOX = Array.new(H).map { Array.new(W, '.') }
M.times do
  x, y = gets.chomp.split.map(&:to_i)
  BOX[x-1][y-1] = '#'
end

def count_bom(i, j, box)
  c = 0
  0.upto(box.length-1) do |h|
    c += 1 if box[h][j] == '#'
  end
  0.upto(box.first.length-1) do |w|
    c += 1 if box[i][w] == '#'
  end
  c -= 1 if box[i][j] == '#'
  c
end

max = 0
0.upto(H-1) do |i|
  0.upto(W-1) do |j|
     max = [max, count_bom(i, j, BOX)].max
  end
end

print max