#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MAX = 1000005;
int SetBit(int n, int x) { return n | (1 << x); }
int ClearBit(int n, int x) { return n & ~(1 << x); }
int ToggleBit(int n, int x) { return n ^ (1 << x); }
bool CheckBit(int n, int x) { return (bool)(n & (1 << x)); }
int main(void) {
  int n, i, arr[105], sum, ans;
  double avg;
  while (scanf("%d", &n) != EOF) {
    sum = 0;
    for (i = 0; i < n; i++) {
      scanf("%d", &arr[i]);
      sum += arr[i];
    }
    sort(arr, arr + i);
    ans = 0;
    avg = sum / (double)n;
    for (i = 0; i < n; i++) {
      if (avg >= 4.5)
        break;
      else {
        sum += (5 - arr[i]);
        arr[i] = 5;
        avg = sum / (double)n;
        ++ans;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
