#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    long long n;
    cin >> n;
    long long a[n];
    for(long long i = 1; i < n + 1; i++) cin >> a[i];
    long long q;
    cin >> q;
    long long b[100000], c[100000];
    for(long long i = 1; i < q + 1; i++)
    {
        long long br = 0;
        cin >> b[i] >> c[i];
        for(long long j = b[i]; j < c[i]; j++) if(a[b[i]] > a[b[i]+1]) br++;
        if(br == 0 || br == 1)
        {
            cout << br << endl;
            cout << "DA" << endl;
        }
        else
        {
            cout << br << endl;
            cout << "NE" << endl;
        }
    }
    return 0;
}