import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int height = sc.nextInt();
int width = sc.nextInt();
sc.nextLine();
int[] first = null;
int[] last = new int[2];
char[][] map = new char[width][height];
for (int h = 0; h < height; h++) {
String line = sc.nextLine();
for (int w = 0; w < line.length(); w++) {
//--
char c = line.charAt(w);
if (c == '*') {
if (first == null) {
first = new int[]{h, w};
}
last[0] = h;
last[1] = w;
}
map[w][h] = line.charAt(w);
}
}
int count = 0;
for (int h = first[0]+1; h < last[0]; h++) {
for (int w = first[1]+1; w < last[1]; w++) {
if(map[w][h] == '@') {
count++;
}
}
}
System.out.println(count);
}
}