#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    double n, i, sum = 0, e;
    map<long long int, long long int> m;
    cin >> n;
    for (i = 0; i < n; i++) {
      cin >> e;
      m[e]++;
      sum += e;
    }
    double req = ((9 * n) / 2) - sum;
    int k = 0;
    if (req <= 0)
      cout << 0;
    else {
      while (m[2] != 0 && req > 0) {
        req -= 3;
        m[2]--;
        k++;
      }
      if (req <= 0) {
        cout << k;
        return 0;
      }
      while (m[3] != 0 && req > 0) {
        req -= 2;
        m[3]--;
        k++;
      }
      if (req <= 0) {
        cout << k;
        return 0;
      }
      while (m[4] != 0 && req > 0) {
        req -= 1;
        m[4]--;
        k++;
      }
      if (req <= 0) {
        cout << k;
        return 0;
      }
    }
  }
  return 0;
}
