In each of the memory elements 251b and 261b, the back gate of the transistor 262 is electrically connected to a wiring 259. By controlling the potential supplied to the wiring 259, the threshold voltage of the transistor 262 can be appropriately changed.
<Examples of Memory Device>
Examples of a memory device including any of the above memory elements are shown in circuit diagrams in FIGS. 32A and 32B. A memory device 300 illustrated in FIG. 32A includes a memory circuit 310 and a voltage retention circuit 320. A memory device 300a illustrated in FIG. 32B includes a memory circuit 310a and a voltage retention circuit 320a. The memory circuits 310 and 310a each include a plurality of memory elements. FIGS. 32A and 32B illustrate the case where three memory elements 261b (memory elements 261b_1 to 261b_3) are provided.