#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(vector<T>& v) {
  for (int i = 0; i < v.size(); ++i) {
    cin >> v[i];
  }
}
template <class T>
vector<T> read_and_create_vector(int n, bool sorted = false) {
  vector<T> v(n);
  read(v);
  sort(v.begin(), v.end());
  return v;
}
void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  read(v);
  sort(v.begin(), v.end());
  double s = 0;
  for (int i = 0; i < n; ++i) {
    s += v[i];
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    if ((s / double(n)) >= 4.5) {
      cout << ans;
      return;
    }
    s -= v[i];
    s += 5;
    ans++;
    if ((s / double(n)) >= 4.5) {
      cout << ans;
      return;
    }
  }
}
int main() { solve(); }
