#include <bits/stdc++.h>
using namespace std;
bool check(long long int s, long long int n) {
  float x = (s / (n * 1.0));
  return (x >= 4.5);
}
void func() {
  long long int n;
  cin >> n;
  long long int p[n], s = 0;
  map<long long int, long long int> m;
  for (long long int i = 0; i < n; ++i) {
    cin >> p[i];
    s += p[i];
    m[p[i]]++;
  }
  long long int count = 0;
  while (!check(s, n)) {
    count++;
    if (m[2]) {
      s += 3;
      m[2]--;
    } else {
      if (m[3]) {
        s += 2;
        m[3]--;
      } else {
        s++;
      }
    }
  }
  cout << count << '\n';
}
int32_t main() {
  func();
  return 0;
};
