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

using namespace std;

int main() {
    vector<int> foo = {0, 42, 0, 42, 0, 42};
    replace(begin(foo), end(foo), static_cast<int>(foo.front()), 13);
    
    for(const auto& i : foo) cout << i << '\t';
}