#include <bits/stdc++.h>
using namespace std;
inline int getnum() {
  char c = getchar();
  int num, sign = 1;
  for (; c < '0' || c > '9'; c = getchar())
    if (c == '-') sign = -1;
  for (num = 0; c >= '0' && c <= '9';) {
    c -= '0';
    num = num * 10 + c;
    c = getchar();
  }
  return num * sign;
}
vector<int> V[100005];
int P[100005][22], L[100005], C[100005];
int Pow[22];
int DFS(int n) {
  for (int i = 1; Pow[i] <= L[n]; i++) P[n][i] = P[P[n][i - 1]][i - 1];
  for (int i = 0; i < V[n].size(); i++) {
    int x = V[n][i];
    if (L[x] != 0) continue;
    P[x][0] = n;
    L[x] = L[n] + 1;
    C[n] += DFS(x);
  }
  return C[n];
}
int Ancestor(int n, int l) {
  for (int i = 0; Pow[i] <= l; i++) {
    if (l & Pow[i]) n = P[n][i];
  }
  return n;
}
int main() {
  int n = getnum();
  Pow[0] = 1;
  for (int i = 1; i <= 20; i++) Pow[i] = Pow[i - 1] * 2;
  for (int i = 1; i <= n - 1; i++) {
    C[i] = 1;
    C[i + 1] = 1;
    int a = getnum(), b = getnum();
    V[a].push_back(b);
    V[b].push_back(a);
  }
  L[1] = 1;
  DFS(1);
  for (int q = getnum(); q; q--) {
    int u = getnum(), d = getnum();
    if (L[u] % 2 != L[d] % 2) {
      puts("0");
      continue;
    }
    if (d == u) {
      printf("%d\n", n);
      continue;
    }
    if (L[u] > L[d]) swap(u, d);
    int p = Ancestor(d, L[d] - L[u]);
    if (p == u) {
      int uu = Ancestor(d, (L[d] - L[u]) / 2);
      int dd = Ancestor(d, (L[d] - L[u]) / 2 - 1);
      printf("%d\n", C[uu] - C[dd]);
    } else {
      int l = u, r = p;
      for (int i = 20; i >= 0; i--) {
        if (P[l][i] != P[r][i]) l = P[l][i], r = P[r][i];
      }
      if (L[d] == L[u])
        printf("%d\n", n - C[l] - C[r]);
      else {
        l = P[l][0];
        int x = L[d] - L[l] + L[u] - L[l];
        x = x / 2;
        l = Ancestor(d, x);
        r = Ancestor(d, x - 1);
        printf("%d\n", C[l] - C[r]);
      }
    }
  }
}
