#include<bits/stdc++.h>
using namespace std;
int n,m;
int sx,sy,ex,ey;
struct node{
int tx,ty;
}a[10001];
int mmap[1001][1001];
bool vis[1001][1001];
int ans;
int t;
int dx[4]={-1,0,1,0};
int dy[4]={0,-1,0,1};
queue<int> xx,yy;
void bfs(int x,int y)
{
xx.push(x);
yy.push(y);
vis[x][y]=true;
while(!xx.empty())
{
int now_x=xx.front();
int now_y=yy.front();
if(now_x==ex && now_y==ey)
{
ans++;
}
xx.pop();
yy.pop();
for(int i=0;i<4;i++)
{
int next_x=now_x+dx[i];
int next_y=now_y+dy[i];
if(next_x>=1 && next_x<=n && next_y>=1 && next_y<=m && !mmap[next_x][next_y] && !vis[next_x][next_y])
{
xx.push(next_x);
yy.push(next_y);
vis[next_x][next_y]=true;
}
}
}
return;
}
int main(){
cin>>n>>m>>t;
cin>>sx>>sy>>ex>>ey;
for(int i=1;i<=t;i++)
{
cin>>a[i].tx>>a[i].ty;
mmap[a[i].tx][a[i].ty]=1;
}
bfs(sx,sy);
cout<<ans<<endl;
return 0;
}