public static void main(String[] args){
		
		Scanner in = new Scanner(System.in);
		
		int r= in.nextInt();
		int c= in.nextInt();
		
		int[][] A = new int[r][c];
		for(int i=0;i<r;i++){
			for(int j=0;j<c;j++){
				A[i][j]=in.nextInt();
			}
		}
		
		System.out.println(count(A));
	}