#include <cstdint>
#include <iostream>
#include <limits>
#include <sys/types.h>

using ull = uint64_t;

constexpr ull ullmax=std::numeric_limits<ull>::max();
ull n;

int main(){
    // std::cin>>*(ll *)(void*)&n;
    std::cin>>n;
    ull ans=0;
    for(ull i=1;i<=n;i++){
        static ull x,y;
        std::cin>>x>>y;
        static std::hash<ull> hash;
        static ull *arr =[]()->ull*{
            ull *a =  new ull(ullmax+1);
            for(ull i=0;i<ullmax;i++){
                a[i]=0;
            }
            return a;
        }();
        ans=ans+i*arr[hash(x)]%ullmax;
    }
}