package main import . "fmt" import . "slices" func main() { var n int Scan(&n) a:=make([]int,n) b:=make([]int,n) for i:=range a { Scan(&a[i]) } for i:=range b { Scan(&b[i]) } Sort(a) x,y,z:=0,1,0 for _,v:=range a { c:=0 for _,w:=range b { if v>w { c++ } } if c>0 { y*=x+c x+=c-1 } else { z++ } } y*=z*(z+1)/2 Println(y) }