#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50;
using ull = unsigned long long;
ull s[N];
pair<ull, ull> ps[N];
int main()
{
    ios::sync_with_stdio(false);
    int n, q;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> s[i];
    sort(s, s + n);
    n = unique(s, s + n) - s;
    cin >> q;
    while (q--)
    {
        ull L, R, ans = 0;
        cin >> L >> R;
        //R -= L, L = 0;
        for (int i = 0; i < n; i++) ps[i] = make_pair(s[i] + L, s[i] + R);
        for (int i = 1; i < n; i++)
            if (ps[i - 1].second >= ps[i].first)
            {
                ps[i].first = ps[i - 1].first;
                ps[i - 1] = make_pair(0, 0);
            }
        for (int i = 0; i < n; i++)
            if (ps[i].first | ps[i].second)
                ans += ps[i].second - ps[i].first + 1;
        cout << ans << " ";
    }
    return 0;
}
