N,M,*P = $<.read.split.map &:to_i
C = [1]*(N+1)
A = C.map {[]}
P.each_slice(2).map{|s| a,b = s; a<b ? s : [b,a]}.sort!.each{|a,b| A[a] << b}
1.upto(N) {|i|
  j = (a=A[i]).map{A[_1][-1] || _1}.max
  next  unless j &.> i
  a.each {b=A[_1]; b << j  if b[-1]!=j}
  C[j] += C[i]
}
p C.max