#include <bits/stdc++.h>
using namespace std;
int to[200002], ne[200002], head[100002], size[100002], de[100002],
    anc[100002][15];
int n, tot, m;
void add(int x, int y) { to[++tot] = y, ne[tot] = head[x], head[x] = tot; }
void read(int &x) {
  int f = 1;
  x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
void dfs(int x, int fa) {
  size[x] = 1, de[x] = de[fa] + 1, anc[x][0] = fa;
  for (int i = 1; i < 14; i++) anc[x][i] = anc[anc[x][i - 1]][i - 1];
  for (int i = head[x]; i; i = ne[i]) {
    if (to[i] == fa) continue;
    dfs(to[i], x);
    size[x] += size[to[i]];
  }
}
void getans(int x, int y) {
  if (x == y) {
    printf("%d\n", size[1]);
    return;
  }
  if (de[x] == de[y]) {
    for (int i = 14; i >= 0; i--) {
      if (anc[x][i] != anc[y][i]) x = anc[x][i], y = anc[y][i];
    }
    printf("%d\n", size[1] - size[x] - size[y]);
    return;
  }
  if (de[x] < de[y]) swap(x, y);
  if ((de[x] - de[y]) & 1) {
    printf("0\n");
    return;
  }
  int x1 = x, d = (de[x] - de[y]) >> 1;
  for (int i = 13; i >= 0; i--) {
    if (de[anc[x][i]] >= de[y]) x = anc[x][i];
  }
  if (x == y) {
    d = de[x] + d;
    for (int i = 13; i >= 0; i--) {
      if (de[anc[x1][i]] > d) {
        x1 = anc[x1][i];
      }
    }
    printf("%d\n", size[anc[x1][0]] - size[x1]);
    return;
  }
  for (int i = 13; i >= 0; i--) {
    if (anc[x][i] != anc[y][i]) x = anc[x][i], y = anc[y][i];
  }
  d = de[x] - 1 + d;
  for (int i = 13; i >= 0; i--) {
    if (de[anc[x1][i]] > d) x1 = anc[x1][i];
  }
  printf("%d\n", size[anc[x1][0]] - size[x1]);
}
int main() {
  read(n);
  for (int i = 1; i < n; i++) {
    int x, y;
    read(x), read(y);
    add(x, y), add(y, x);
  }
  dfs(1, 1);
  read(m);
  for (int i = 1; i <= m; i++) {
    int x, y;
    read(x), read(y);
    getans(x, y);
  }
  return 0;
}
