#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 0, m, n;
  cin >> n;
  float a = 0, b;
  std::vector<long long> v(n);
  for (long long i = 0; i < n; i++) {
    cin >> v[i];
    a += v[i];
  }
  a = a / n;
  if (a >= 4.5) {
    cout << 0 << '\n';
    return 0;
  }
  b = (4.5 - a) * n;
  m = ceil(b);
  sort(v.begin(), v.end());
  for (long long i = 0; i < n; i++) {
    if (m > 0) {
      m -= (5 - v[i]);
      t++;
    }
  }
  cout << t << '\n';
  return 0;
}
