#include <iostream>
#include <stdio.h>using namespace std;
int main(int argc, char** argv) {
int n;
scanf("%d",&n);
int counta=0,countb=0;
while(n--) {
int as,ac,bs,bc;
scanf("%d%d%d%d",&as,&ac,&bs,&bc);
if(ac==as+bs && bc!=as+bs) countb++;
if(bc==as+bs && ac!=as+bs) counta++;
}
printf("%d %d",counta,countb);
return 0;
}