#include <iostream>

using namespace std;

int main()
{
int Q , N , C, br1=0;
cin >> N>> C >> Q;
short a[N];
int l , r;
for(int i = 0; i<N;i++)
{
    cin >> a[i];
    if(a[i] == 1)
        br1++;
}

for(int i = 0; i<Q; i++)
{
    cin >> l >> r;
    l--;
    for(int j = l; j < r; j++)
    {
        if(a[j] == 1)
        {
            br1--;
            a[j] = 0;
        }
        else
        {
            br1++;
            a[j] = 1;

        }

    }
    cout << br1 << endl;
}

    return 0;
}