#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int maxn=200007;

long long n,a[maxn],pre[maxn],r,now,t,res,s[maxn];

int main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++) {scanf("%lld",&a[i]);pre[i]=pre[i-1]+a[i];s[i]=s[i-1]^a[i];}
	for(int l=1;l<=n;l++){
		while(r<=n){
			r++;
			if(s[r]-s[l-1]!=pre[r]-pre[l-1]){
				cout<<r<<'\n';
				r--;
				break;
			}
		}
		cout<<l<<' '<<r<<' '<<pre[r]<<' '<<pre[l-1]<<'\n';
		res+=r-l+1;
	}
	printf("%lld\n",res);
	return 0;
}
