#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
signed main() {
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  long long int summ = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 2)
      summ -= 5;
    else if (a[i] == 3)
      summ -= 3;
    else if (a[i] == 4)
      summ -= 1;
    else
      summ++;
  }
  sort(a.begin(), a.end());
  long long int cnt = 0;
  for (long long int i = 0; i < n && summ < 0; i++) {
    if (a[i] == 2)
      summ += 6;
    else if (a[i] == 3)
      summ += 4;
    else if (a[i] == 4)
      summ += 2;
    cnt++;
  }
  cout << cnt;
  return 0;
}
