Sum Unique Ranking Values In Columns

I am working with a user preference data set that asks individuals to rank four different choices from 1 to 4.

pref1 <- c("1","2","3","4","4","3","2","1")
pref2 <- c("4","3","2","1","1","2","3","4")
pref3 <- c("2","1","4","3","2","1","4","3")
pref4 <- c("3","4","1","2","3","4","1","2")

preference<- data.frame(pref1,pref2,pref3,pref4)

I am trying to create a fifth column that will count the number of rows that are the same in their preference ranking order. I think that this question makes sense but please let me know if it is unclear.