#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>

using namespace std;

#define INF (1 << 20)
#define MAX_V 12000

struct edge{
	int to;
	int cost;
};

typedef pair<int, int> P; // first??????????????¢???second??????????????????

vector<edge> G[MAX_V];
int d[MAX_V];

// ?????????O(|E|log|V|)

void shortest_path(int s, int V){ // V???????????°
	
	priority_queue<P, vector<P>, greater<P> > que;
	
	for(int i = 0; i < V; i++){
		d[i] = INF;
	}
	d[s] = 0;
	
	que.push(P(0, s));
	
	while(!que.empty()){
		
		P p = que.top();
		que.pop();
		
		int v = p.second;
		
		if(d[v] < p.first){
			continue;
		}
		
		for(int i = 0; i < G[v].size(); i++){
			edge e = G[v][i];
			if(d[e.to] > e.cost + d[v]){
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to));
			}
		} // ????????????????°???????????????´??°
	}
}

int main(){
	
	int W, H;
	
	while(true){
		
		cin >> W >> H;
		
		if(W * H == 0){
			break;
		}
		
		string map[200];
		
		for(int i = 0; i < MAX_V; i++){
			G[i].erase(G[i].begin(), G[i].end());
		}
		
		for(int i = 0; i < H; i++){
			cin >> map[i + 1];
			map[i + 1] = "." + map[i + 1] + ".";
		}
		
		H += 2;
		W += 2;
		
		string str = "";
		
		for(int i = 0; i < W; i++){
			str = str + ".";
			map[0] = str;
			map[H - 1] = str;
		}
		
		
		for(int i = 0; i < H - 1; i++){
			for(int j = 0; j < W; j++){
				int index1 = i * W + j;
				int index2 = (i + 1) * W + j;
				int cost;
				if(map[i][j] != map[i + 1][j] && (map[i][j] == '#' || map[i + 1][j] == '#')){
					cost = 1;
				}else{
					cost = 0;
				}
				edge e1, e2;
				e1.to = index2;
				e2.to = index1;
				e1.cost = cost;
				e2.cost = cost;
				G[index1].push_back(e1);
				G[index2].push_back(e2);
			}
		}
		
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W - 1; j++){
				int index1 = i * W + j;
				int index2 = i * W + j + 1;
				int cost;
				if(map[i][j] != map[i][j + 1] && (map[i][j] == '#' || map[i][j + 1] == '#')){
					cost = 1;
				}else{
					cost = 0;
				}
				edge e1, e2;
				e1.to = index2;
				e2.to = index1;
				e1.cost = cost;
				e2.cost = cost;
				G[index1].push_back(e1);
				G[index2].push_back(e2);
			}
		}
		
		int index_goal;
		
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				if(map[i][j] == '&'){
					index_goal = i * W + j;
				}
			}
		}
		
		int V = H * W;
		
		shortest_path(0, V);
		
		cout << d[index_goal] / 2 << endl;
		/*
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				cout << d[i * W + j] << " ";
			}
			cout << endl;
		}
		*/
	}
	return 0;
}