import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        List<Integer> numList = new ArrayList();
        while (sc.hasNextInt()) {
            numList.add(sc.nextInt());
        }
        List<Integer> tGroup = new ArrayList();
        List<Integer> fGroup = new ArrayList();
        Map<String, List<Integer>> map = numberGroup(numList, tGroup, fGroup, 0);
        if (map != null) {
            System.out.println("true");
        } else {
            System.out.println("false");
        }
    }

    private static Map<String, List<Integer>> numberGroup(List<Integer> numList, List<Integer> tGroup, List<Integer> fGroup, int index) {
        if (index == numList.size()) {
            int tSum = 0, fSum = 0;
            if (tGroup.size() > 0) {
                tSum = tGroup.stream().reduce((a, b) -> a + b).get();
            }
            if (fGroup.size() > 0) {
                fSum = fGroup.stream().reduce((a, b) -> a + b).get();
            }
            if (tSum == fSum) {
                Map<String, List<Integer>> map = new HashMap<>();
                map.put("t", tGroup);
                map.put("f", fGroup);
                return map;
            } else {
                return null;
            }
        }
        int num = numList.get(index);
        List<Integer> ntGroup = new ArrayList<>(tGroup);
        List<Integer> nfGroup = new ArrayList<>(fGroup);
        ntGroup.add(num);
        nfGroup.add(num);
        if (num % 3 == 0) {
            return numberGroup(numList, ntGroup, fGroup, index + 1);
        }
        if (num % 5 == 0) {
            return numberGroup(numList, tGroup, nfGroup, index + 1);
        }
        return Optional.ofNullable(numberGroup(numList, ntGroup, fGroup, index + 1)).orElse(numberGroup(numList, tGroup, nfGroup, index + 1));
    }
}