#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];
  sort(a.begin(), a.end());
  int sum = accumulate(a.begin(), a.end(), 0);
  if (sum / (double)n >= 4.5) {
    cout << 0 << endl;
    return 0;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ++ans;
    sum = sum - a[i] + 5;
    if (sum / (double)n >= 4.5) break;
  }
  cout << ans << endl;
  return 0;
}
