Relational characterizations of permutable and $n$-permutable varieties