#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
const int N = 2e5 + 10, M = 1e6 + 10, OOm = 0x3f3f3f3f;
string blank = "";
void solve() {
  int n;
  cin >> n;
  int arr[n];
  int sum = 0, ans = 0;
  for (int i = 0; i < n; i++) cin >> arr[i], sum += arr[i];
  sort(arr, arr + n);
  for (int i = 0; i < n && round(sum / (n * 1.0)) != 5; i++)
    sum += 5 - arr[i], ans++;
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  solve();
  cerr << "Time elapsed: " << clock() / 1000 << " ms" << '\n';
}
