#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += a[i];
  }
  float sol = 0;
  int cnt = 0;
  sol = float(sum) / float(n);
  float temp = (4.5 * float(n)) - (float(n) * sol);
  if (temp <= 0) {
    cout << cnt;
  } else {
    sort(a.begin(), a.end());
    int i = 0;
    while (temp > 0) {
      cnt++;
      temp -= (5 - a[i]);
      i++;
    }
    cout << cnt;
  }
  return 0;
}
