import java.util.*;
public class xiaowuc1 {
  public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String[] l = new String[n];
    for(int i = 0; i < n; i++) l[i] = sc.next();
    for(int ret = 1; true; ret++) {
      boolean good = true;
      for(int i = 0; good && i < n; i++) {
        good = l[i].equals(get(ret*(i+1)));
      }
      if(good) {
        System.out.println(ret);
        break;
      }
    }
  }
  public static String get(int n) {
    n %= 28;
    if(n <= 0) return "New";
    if(n <= 4) return "Crescent";
    if(n <= 8) return "Quarter";
    if(n <= 13) return "Gibbous";
    if(n <= 14) return "Full";
    if(n <= 19) return "Gibbous";
    if(n <= 22) return "Quarter";
    if(n <= 27) return "Crescent";
    throw new RuntimeException();
  }
}
