3 of 5 added 8 characters in body

Perl, 47 45 43 bytes

@a=1..<>;for(@a){$a=$_;say map{$_==$a|0}@a}

Running with the -E perlrun:

$ echo 3 | perl -E'@a=1..<>;for(@a){$a=$_;say map{$_==$a|0}@a}'
100
010
001