n = gets.to_i
edge = (n-1).times.map{gets.split.map(&:to_i)}
vert = (0..n).map{[]}

edge.each{|e|
  vert[e[0]] << e
  vert[e[1]] << e
}
q = [1,0,0]
while q[0]
  a,parent,parent_color = q.pop
  color = (parent_color==1)? 2 : 1
  vert[a].each{|e|
    b = (e[0]==a) ? e[1] : e[0]
    next if b == parent
    e[2] = color
    q << [b,a,color]
    color += 1
    color += 1 if color == parent_color
  }
end
colors = edge.map{|e|e[2]}
p colors.max
puts colors