#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const int base = 31337;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const int logo = 20;
const int off = 1 << logo;
const int treesiz = off << 1;
int n;
int niz[maxn];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", niz + i);
    niz[i] *= 2;
  }
  int sum = 0;
  for (int i = 0; i < n; i++) sum += niz[i];
  if (sum >= 9 * n)
    printf("0");
  else {
    sort(niz, niz + n);
    for (int i = 0; i < n; i++) {
      sum += 10 - niz[i];
      if (sum >= 9 * n) {
        printf("%d\n", i + 1);
        break;
      }
    }
  }
  return 0;
}
