#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long int n;
  cin >> n;
  long long int a[6] = {0};
  for (long long int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    a[x]++;
  }
  double u = 4.5 * double(n);
  double t = double(2 * a[2] + 3 * a[3] + 4 * a[4] + 5 * a[5]);
  long long int ans = 0;
  while (u > t) {
    if (a[2] > 0) {
      a[2]--;
      a[5]++;
      t = double(2 * a[2] + 3 * a[3] + 4 * a[4] + 5 * a[5]);
      ans++;
      continue;
    } else if (a[3] > 0) {
      a[3]--;
      a[5]++;
      t = double(2 * a[2] + 3 * a[3] + 4 * a[4] + 5 * a[5]);
      ans++;
      continue;
    }
    if (a[4] > 0) {
      a[4]--;
      a[5]++;
      t = double(2 * a[2] + 3 * a[3] + 4 * a[4] + 5 * a[5]);
      ans++;
      continue;
    }
  }
  cout << ans;
  return 0;
}
