#ifdef LOCAL
#include ".debug.hpp"
#else
#define debug(...) 42
#endif
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
signed main() {
#ifndef VOID
cin.tie(nullptr)->sync_with_stdio(false);
#endif
int N, M; cin >> N >> M;
set<char> S;
vector<vector<char>> A(N, vector<char> (M)); for (int i = 0; i < N; i++) for (int j = 0; j < M; j++) {
cin >> A[i][j];
if (A[i][j] != '.') S.insert(A[i][j]);
}
cout << "4\n";
return 0;
}