x <- c(2,5,3,9,8,11,6)
count <- 0

for (val in x) 
  {
  if(val %% 2 == 0)  
    count = count + 1
  }
print(count)
## [1] 3