#include<iostream>
using namespace std;
int main(){
    int n=1,A=0,B=0;
    while(n!=0){
        cin>>n;
        if(n==0){break;}
        for(int i=0;i<n;i++){
            int ap=0,bp=0;
            cin>>ap;
            cin>>bp;
            if(ap<bp){
                B=B+ap+bp;
            }
            if(ap>bp){
                A=A+ap+bp;
            }
            if(ap==bp){
                A=A+ap;
                B=B+bp;
            }
        }
        cout<<A<<" "<<B<<endl;
        A=0;B=0;
    }
    return 0;
}
 #include<bits/stdc++.h>
 using namespace std;
 #define For(start,end) for(int i = (int)start;i<(int)end;i++)
 using Int = long long int;
 int main(){
    set<int>paper;
    int N;
    cin >> N;
    For(0,N)
    {
        int before_size=paper.size();
        int tmp;
        cin>>tmp;
        paper.insert(tmp);
        if(paper.size()==before_size)
        {
            paper.erase(tmp);
        }
    }
    cout<<paper.size()<<endl;
 }