#include <bits/stdc++.h>
int performance[5], n;
int main() {
  int a;
  std::cin >> n;
  for (int group = -1; group < 2; group += 2) {
    for (int i = 0; i < n; i++) {
      std::cin >> a;
      performance[a - 1] += group;
    }
  }
  int res = 0;
  int sum_diff = 0;
  for (int performance_diff : performance) {
    if (performance_diff % 2 != 0) {
      std::cout << "-1\n";
      return 0;
    }
    res += std::abs(performance_diff);
  }
  std::cout << res / 4 << std::endl;
}
