#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  double arr[n];
  double sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    sum += arr[i];
  }
  sort(arr, arr + n);
  for (int i = 0; i < n; i++) {
    if (sum / n >= 4.5) {
      cout << i << endl;
      return 0;
    }
    sum -= arr[i];
    sum += 5;
  }
  cout << n << endl;
}
