class Point
  attr_accessor :x, :y
  def initialize(i = 0, j = 0)
    @y = i
    @x = j
  end
  def ==(p)
    @y == p.y && @x == p.x
  end
  def +(add)
    Point.new(@y + add.y, @x + add.x)
  end
  def -(sub)
    Point.new(@y - sub.y, @x - sub.x)
  end
  def distance(p)
    (@y - p.y)**2 + (@x - p.x)**2
  end
end

def check(tile, p1, p2)
  add = Point.new
  add.y = ((p1.y < p2.y) ? 1 : -1) if p1.x == p2.x
  add.x = ((p1.x < p2.x) ? 1 : -1) if p1.y == p2.y
  now = p1.dup + add
  return false if now == p2
  while now != p2 do
    return false if tile[now.y][now.x] != "."
    now += add
  end
  return true
end

def delete!(tile, p1, p2)
  if p1.x == p2.x || p1.y == p2.y
    if check(tile, p1, p2)
      tile[p1.y][p1.x] = tile[p2.y][p2.x] = "."
      return true
    end
    return false
  end

  2.times do
    p1, p2 = p2, p1
    q = Point.new(p1.y, p2.x)
    next if tile[q.y][q.x] != "."
    next if q.distance(p1) != 1 && !check(tile, q, p1)
    next if q.distance(p2) != 1 && !check(tile, q, p2)
    tile[p1.y][p1.x] = tile[p2.y][p2.x] = "."
    return true
  end
  return false
end

H, W = gets.split.map(&:to_i)
tile = Array.new
H.times do
  tile.push(gets.chop.chars)
end

point = Hash.new {|h, k| h[k] = Array.new}
for i in 0...H do
  for j in 0...W do
    next if tile[i][j] == "."
    point[tile[i][j]].push(Point.new(i,j))
  end
end

answer = 0
26.times do
  point.each do |key, p|
    if delete!(tile, p[0], p[1])
      answer += 2
      point.delete(key)
    end
  end
end
p answer