#include <bits/stdc++.h>
using namespace std;
template <ostream& out = cout, class... T>
void prints(T&&...) {}
template <ostream& out = cout, class... T>
void printe(T&&...) {}
template <ostream& out = cout, class... T>
void printw(T&&...) {}
template <ostream& out = cout, class... T>
void printew(T&&...) {}
template <ostream& out = cout, class... T>
void printb(T&&...) {}
template <ostream& out = cout, class... T>
void printd(T&&...) {}
template <ostream& out = cout, class... T>
void printde(T&&...){};
template <class T>
istream& operator>>(istream& in, vector<T>& v) {
  for (auto& e : v) {
    in >> e;
  }
  return in;
}
template <char d = ' ', class T>
ostream& operator<<(ostream& out, vector<T>& v) {
  for (auto& e : v) {
    out << e << d;
  }
  return out;
}
long long gcd(long long a, long long b) { return a == 0 ? b : gcd(b % a, a); }
int main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long j = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    j += a[i];
  }
  if (round((double)j / n) >= 4.5) {
    cout << 0;
    return 0;
  }
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) {
    j += 5 - a[i];
    if (round((double)j / n) >= 4.5) {
      cout << i + 1;
      return 0;
    }
  }
}
