# count function

How many elements of a list equal a value.

## How to write it

### count(list, x)

**list**

The list. Takes a list.

**x**

The value to count. Takes an expression.

## Examples

- $\displaystyle \operatorname{count}(\left[ 1, 2, 1 \right], 1) = 2$

  `count([1, 2, 1], 1)`

  In the solver, `count([1, 2, 1], 1)` gives `2`.

  [Open in the solver](https://hilberon.com/?q=count%28%5B1%2C%202%2C%201%5D%2C%201%29)

## Related functions

- [dimensions](https://hilberon.com/library/dimensions)

  The size of a list or a matrix, level by level.
- [constant_array](https://hilberon.com/library/constant_array)

  A list of copies of a value.
- [drop](https://hilberon.com/library/drop)

  A list without its first elements.
- [complement](https://hilberon.com/library/complement)

  The elements of a list that are in none of the others.
- [first](https://hilberon.com/library/first)

  The first element of a list.
- [apply](https://hilberon.com/library/apply)

  Replace the head of an expression, or the brackets of a list, with a function.

---
Source: https://hilberon.com/library/count
