let input = require('fs').readFileSync('/dev/stdin', 'utf8')
// let input = require('fs').readFileSync('./sample_d.txt', 'utf8')
.split(/\n| /)
.slice(0 ,-1)
.map(item => parseInt(item))


const [N, M, ..._pair] = input
const pair = []
for(let i=0; i<N; i++){
    pair.push(new Array(N-i).fill(true))
}

for(let i=0; i<_pair.length; i+=2){
    const a = [_pair[i], _pair[i+1]].sort()
    pair[a[0]-1][a[1]-a[0]] = false
}


const member = [ new Set() ]

pair[0].forEach( (item, index) => {
    if(item) member[0].add(index+1)
    else{
        member.push(new Set())
        member[member.length-1].add(index+1)
    }
} )

for( let i=1; i<N; i++){
    for( let j=1; j<pair[i].length; j++){
        if(!pair[i][j]){
            member.forEach( (sample, index) => {
                if( sample.has(i+1) && sample.has(i+j+1) ){
                    sample.delete(i+j)
                    if(member.length - 1 <= index) member.push(new Set())
                    member[index+1].add(i+j)
                }
            })
        }
    }
}

console.log(member.length)