Please Find edge case i am missing in code

Here is the Link to my submission to “Charge” CodeChef: Practical coding for everyone

Please tell me the edge case i am missing
Please tell me if anyone want to understand the algo

cin>>q;
        if(q>1){
            if(s[q-1] != s[q-2]){
                sum += 1;
            }else{
                sum -= 1;
            }
        }
        if(q<n){
            if(s[q-1] != s[q]){
                sum += 1;
            }else{
                sum -= 1;
            }
        }
        s[q-1] = '1' - s[q-1] + '0';
        // cout<<s<<nl;
        cout<<sum<<nl;

Will your logic work for N = 1?

Thank you …I got it