#include <stdio.h> #include <stdbool.h> bool solution(int arr5, int arr3, int val[], int total, int index) { if(index == total){ if(arr5 == arr3) return true; else return false; } int temp5 = arr5 + val[index]; int temp3 = arr3 + val[index]; if(solution(temp5 , arr3, val, total, index + 1) || solution(arr5,temp3,val,total,index + 1)) return true; return false; } int main() { int n; int val[500]; while (scanf("%d", &n) != EOF) { int arr5 = 0; int arr3 = 0; int tempnum = 0; int index = 0; for(int i = 0; i < n; i++) { scanf("%d", &tempnum); if(tempnum % 5 == 0) { arr5 += tempnum; } else if(tempnum % 3 == 0) { arr3 += tempnum; } else { val[index++] = tempnum; } } if(solution(arr5, arr3, val, index, 0)) { printf("true\n"); } else { printf("false\n"); } } return 0; }