#include <bits/stdc++.h>
using namespace std;
const int N = 100001;
int primes[N];
int b[N];
void P() {
  for (int i = 2; i <= N; i++) {
    if (!primes[i]) {
      for (int j = 2 * i; j <= N; j += i) primes[j] = i;
    }
  }
}
void solve() {
  int n;
  cin >> n;
  int x;
  int a1[6] = {0, 0, 0, 0, 0, 0}, b1[6] = {0, 0, 0, 0, 0, 0};
  for (int i = 0; i < 2 * n; i++) {
    cin >> x;
    if (i < n)
      a1[x]++;
    else
      b1[x]++;
  }
  for (int i = 1; i < 6; i++) {
    if ((a1[i] + b1[i]) % 2) {
      cout << "-1";
      return;
    }
  }
  int ans = 0;
  for (int i = 1; i < 6; i++) {
    if (a1[i] > b1[i])
      ans += a1[i] - b1[i];
    else
      ans += b1[i] - a1[i];
  }
  cout << ans / 4;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
}
