#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  double cnt, t, y, m, n, a, b, i, j, x, z, sum, k;
  cin >> t;
  cin.ignore();
  sum = 0;
  vector<long long int> ara, ara1;
  for (i = 0; i < t; i++) {
    cin >> a;
    sum += a;
    ara.push_back(a);
  }
  cnt = 0;
  sort(ara.begin(), ara.end());
  x = sum / t;
  if (x >= 4.5) {
    cout << "0" << endl;
  } else {
    for (i = 0; i < t; i++) {
      y = (sum + (5 - ara[i]));
      if (y / t >= 4.5) {
        cnt++;
        break;
      } else {
        cnt++;
      }
      sum += (5 - ara[i]);
    }
    cout << fixed << setprecision(0) << cnt << endl;
  }
  return 0;
}
