## Perl, <s>47</s> <s>45</s> 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