class Input_kyopro: def II(self): return int(input()) def MI(self): return map(int,input().split()) def MS(self): return map(str,input().split()) def LMI(self): return list(self.MI()) def LMS(self): return list(self.MS()) def LLI(self,N): return [self.LMI() for _ in range(N)] def LLS(self,N): return [self.LMS() for _ in range(N)] def LS(self,N): return [input() for _ in range(N)] def LSL(self,N): return [list(input()) for _ in range(N)] def LI(self,N): return [self.II() for _ in range(N)] I=Input_kyopro() #入力 import bisect,copy class unionfind: def __init__(self,N): self.par=[-1]*(N+1) self.siz=[1]*(N+1) self.max_siz=1 self.group=N def root(self,x): while True: if self.par[x]==-1: break x=self.par[x] return x def unite(self,u,v): RootU=self.root(u) RootV=self.root(v) if RootU==RootV: return self.group-=1 if self.siz[RootU]=2: ans+=a-1 print(ans)