#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, L, Q, tmp, input;
  vector<int> x;
  int a[100000], b[100000];
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> input;
    x.push_back(input);
  }
  cin >> L >> Q;
  for (int i = 0; i < Q; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < Q; i++) {
    int ans = 0;
    while (1) {
      tmp = *(lower_bound(x.begin(), x.end(), a[i] - L));
      if (tmp >= b[i]) {
        cout << ans << endl;
        break;
      }
      ans++;
    }
  }
  return 0;
}
