#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    std::vector<int> numbers = {1, 2, 3, 2, 4, 2, 5, 2};

    int target = 2;

    // 使用 std::count() 函数在向量中计算指定元素的出现次数
    int count = std::count(numbers.begin(), numbers.end(), target);

    // 输出计数结果
    std::cout << "Element " << target << " appears " << count << " times in the vector." << std::endl;

    return 0;
}
