#include #include #include #include #include #include #include using namespace std; using ll = long long; int main() { int n; cin >> n; int x = 0; for (int t : { 0, 2, 4, 5, 7, 9, 11 }) { x ^= 1 << t; } x = x ^ x << 12; int y = 0; for (int i = 0; i < n; i++) { int t; cin >> t; y ^= 1 << t; } int r = -1; for (int j = 0; j < 12; j++) { if (!(y << j & ~x)) { if (r >= 0) { cout << -1 << endl; exit(0); } r = (12 - j) % 12; } } cout << r << endl; return 0; }