#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T& num) {
  num = 0;
  bool f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 0;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    num = num * 10 + ch - '0';
    ch = getchar();
  }
  num = f ? num : -num;
}
template <class T>
inline void write(T x, char ch) {
  int s[100];
  if (x == 0) {
    putchar('0');
    putchar(ch);
    return;
  }
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  int num = 0;
  while (x) {
    s[num++] = (x % 10);
    x = x / 10;
  }
  for (int i = (num - 1); i >= (0); i--) putchar(s[i] + '0');
  putchar(ch);
}
const double pi = acos(-1);
const double eps = 1e-8;
int n;
int a[100005];
bool judge(int x) {
  if (((double)x / (double)n) - 4.5 > -eps)
    return true;
  else
    return false;
}
int main() {
  int sum = 0;
  read(n);
  for (int i = (1); i <= (n); i++) {
    read(a[i]);
    sum += a[i];
  }
  sort(a + 1, a + 1 + n);
  int i = 0;
  while (!judge(sum)) {
    sum += (5 - a[i + 1]);
    i++;
  }
  write(i, '\n');
}
