#include <bits/stdc++.h>
using namespace std;
signed main(int argv, char** argc) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  int a[n];
  int sum = 0;
  vector<int> v(6, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
    v[a[i]]++;
  }
  int res = 0;
  double ort = (double)sum / (double)n;
  if (round(ort) == 5)
    cout << res;
  else {
    for (int i = 2; i <= 4; i++) {
      while (v[i] > 0) {
        res++;
        sum -= i;
        sum += 5;
        ort = double(sum) / (double)n;
        if (round(ort) == 5) {
          cout << res;
          return 0;
        }
        v[i]--;
      }
    }
  }
  return 0;
}
