import java.io.BufferedReader;
import java.io.InputStreamReader;

public class TextRoll_artur {
  public static void main(String[] args) throws Exception {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    for (int n = Integer.parseInt(in.readLine()); n != 0; n = Integer.parseInt(in.readLine())) {
      int pos = 0;
      for (int i = 0; i < n; i++) {
        String s = in.readLine();
        int j = s.indexOf(' ', pos);
        pos = j == -1 ? Math.max(pos, s.length()) : j;
      }
      System.out.println(pos + 1);
    }
  }
}
