cppreference.com > C++ Algorithms > count count Syntax:
      #include <algorithm>
      size_t count( iterator start, iterator end, const TYPE& val );
The count() function returns the number of elements between start and end that match val. For example, the following code uses count() to determine how many integers in a vector match a target value:
     vector<int> v;
     for( int i = 0; i < 10; i++ ) {
       v.push_back( i );
     }

     int target_value = 3;
     int num_items = count( v.begin(), v.end(), target_value );

     cout << "v contains " << num_items << " items matching " << target_value << endl;
The above code displays the following output:
     v contains 1 items matching 3
Related topics: accumulate adjacent_difference count_if inner_product partial_sum