#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using P = pair<string,int>;
const double PI = acos(-1);
string iro(int x){
  string color;
  if(x >= 3200) color = "ziyu";
  else if(x >= 2800) color = "aka";
  else if(x >= 2400) color = "daidai";
  else if(x >= 2000) color = "ki";
  else if(x >= 1600) color = "ao";
  else if(x >= 1200) color = "mizu";
  else if(x >= 800) color = "midori";
  else if(x >= 400) color = "tya";
  else color = "hai";
  return  color;
}
int main() {
 int n;
 cin >> n;
 vector<int> a(n);
 rep(i,n) cin >> a.at(i);
 map<string,int> mp;
 rep(i,n) mp[a.at(i)]++;
 int max,min;
 if(mp.count("ziyu")){
   if(7-mp.size() >= mp["ziyu"]) max = mp.size()+mp["ziyu"]-1;
   else max = 8;

   if(mp.size() > 1) min = mp.size()-1;
   else min = 1;
   
 }
 else{
   max = mp.size();
   min = mp.size();
}
 cout << min << max << endl;

 
} 