Multilevel memory based on molecular devices