Representing powers of 2 by a sum of four integers

We solve an arithmetic problem due to Erdös and Freud (1986) investigated also by Freiman, Nathanson and Sárközy: How many elements from a given set of integers one must take to represent a power of 2 by their sum?