跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F2963. Marks

  • ID: 2969
  • 传统题
  • 2000ms
  • 256MiB
  • 尝试: 0
  • AC · 已通过: 0
  • 教学难度:入门
  • 上传者:
  • 模拟
  • 编程与模拟
  • 入门
  • 难度
  • 共享题库
  • Codeforces
  • 英文题面
  • 题目来源
  • 题面语言

Marks

题目描述

A. Marks
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Vasya, or Mr. Vasily Petrov is a dean of a department in a local university. After the winter exams he got his hands on a group's gradebook.

Overall the group has n students. They received marks for m subjects. Each student got a mark from 1 to 9 (inclusive) for each subject.

Let's consider a student the best at some subject, if there is no student who got a higher mark for this subject. Let's consider a student successful, if there exists a subject he is the best at.

Your task is to find the number of successful students in the group.

Input

The first input line contains two integers n and m (1≤n,m≤100) − the number of students and the number of subjects, correspondingly. Next n lines each containing m characters describe the gradebook. Each character in the gradebook is a number from 1 to 9. Note that the marks in a rows are not sepatated by spaces.

Output

Print the single number − the number of successful students in the given group.

Examples
Input
3 3
223
232
112
Output
2
Input
3 5
91728
11828
11111
Output
3
Note

In the first sample test the student number 1 is the best at subjects 1 and 3, student 2 is the best at subjects 1 and 2, but student 3 isn't the best at any subject.

In the second sample test each student is the best at at least one subject.


题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 2642 题。保留原作者与原赛事署名。