#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main () {
int n, m, t;
cin >> n >> m >> t;
int x, y, x1, y1;
cin >> x >> y >> x1 >> y1;
queue<pair<int, int>> q;
q.emplace(x, y);
vector<vector<bool>> maze(n + 1, vector<bool>(m + 1, false));
maze[x][y] = true;
for (int i = 1; i <= t; ++i) {
int x2, y2;
cin >> x2 >> y2;
maze[x2][y2] = true;
}
int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};
int res = 0;
while (!q.empty()) {
auto t = q.front();
q.pop();
if (t.first == x1 && t.second == y1) {
res++;
}
for (int i = 0; i < 4; ++i) {
int tx = t.first + dx[i];
int ty = t.second + dy[i];
if (maze[tx][ty] != true && tx <= n && ty <= m && tx >= 1 && ty >= 1) {
q.emplace(tx, ty);
maze[tx][ty] = true;
}
}
}
cout << res << endl;
return 0;
}