import java.io.*;
import java.util.*;
import static java.lang.Math.*;

public class Main {

    PrintWriter out;
    FastScanner in;

    String FILE = "robots";

    int n, m, g, ans;
    boolean used[][];
    boolean calced[][];
    char to[][];
    int time[][];
    ArrayList<Integer> pathA;
    ArrayList<Integer> pathB;

    void goTo(int a, int b, int tarA, int tarB, int timer) {
        calced[a][b] = true;

        if (a == tarA && b == tarB && timer > 0)
            return;

        if (to[a][b] == 'n') {
            goTo(a - 1, b, tarA, tarB, timer + 1);
        } else if (to[a][b] == 's') {
            goTo(a + 1, b, tarA, tarB, timer + 1);
        } else if (to[a][b] == 'e') {
            goTo(a, b + 1, tarA, tarB, timer + 1);
        } else if (to[a][b] == 'w') {
            goTo(a, b - 1, tarA, tarB, timer + 1);
        }
    }

    void dfs(int a, int b) {
        time[a][b]++;

        if (time[a][b] == 100 * 100 + 5) {
            ans++;
            return;
        } else if (time[a][b] > 100 * 100 + 5) {
            return;
        }

        if (to[a][b] == 'n') {
            dfs(a - 1, b);
        } else if (to[a][b] == 's') {
            dfs(a + 1, b);
        } else if (to[a][b] == 'e') {
            dfs(a, b + 1);
        } else if (to[a][b] == 'w') {
            dfs(a, b - 1);
        }
    }

    public void solve() {
        n = in.nextInt();
        m = in.nextInt();
        g = in.nextInt();
        ans = 0;
        used = new boolean[n][m];
        calced = new boolean[n][m];
        to = new char[n][m];
        time = new int[n][m];
        pathA = new ArrayList<>();
        pathB = new ArrayList<>();

        for (int i = 0; i < n; i++) {
            String s = in.next();
            for (int z = 0; z < m; z++) {
                to[i][z] = Character.toLowerCase(s.charAt(z));
            }
        }

        for (int i = 0; i < n; i++) {
            for (int z = 0; z < m; z++) {
                dfs(i, z);
            }
        }

        out.print(ans);
    }

    public void run() {
        if (!FILE.isEmpty()) {
            try {
                in = new FastScanner(new FileReader(FILE + ".in"));
                out = new PrintWriter(FILE + ".out");
            } catch (IOException e) {
                e.printStackTrace();
                System.exit(1);
            }
        } else {
            in = new FastScanner(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
        }

        solve();

        out.close();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer in;

        public FastScanner(Reader reader) {
            br = new BufferedReader(reader);
        }

        public String next() {
            while (in == null || !in.hasMoreTokens()) {
                try {
                    in = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return in.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new Main().run();
    }

}