#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  scanf("%lld", &N);
  long long dat[N];
  long long sum = 0;
  for (long long i = 0; i < N; ++i) {
    scanf("%lld", &dat[i]);
    sum += dat[i];
  }
  double avg = (double)sum / (double)N;
  if (avg >= 4.5) {
    puts("0");
    return 0;
  }
  long long cnt = 0;
  while (avg < 4.5) {
    long long idx = min_element((dat), (dat) + (N)) - dat;
    sum += (5 - dat[idx]);
    avg = (double)sum / (double)N;
    dat[idx] = 5;
    ++cnt;
  }
  cout << cnt << endl;
  return 0;
}
