Initially, Page fault Count =0
After first 3 pages ,i.e 1,2,1 Page Fault count=2.
After 4 pages i.e 1,2,1,3 Page Fault count =3.
After 5 pages i.e.1,2,1,3,7 ,we have to replace one page out 3 from above situation ,candidate for page replacement is 1,2,3 we choose page No.2 .reason=we use optimal page replacement ,so we see the future reference of page and came to conclusion that page No=2 have No reference in future or if they have reference in future ,which is late bit as compare to page no.1 and 3 .
Page fault count=4
After 6 pages i.e.1,2,1,3,7,4. we choose page 7 for replacement with same logic as above. Page Fault Count =5
After 7 pages i.e.1,2,1,3,7,4,5 we choose page 4 for replacement.Page Fault count=6
After 8 pages i.e.1,2,1,3,7,4,5,6 .we choose page 5 for replacement.page fault count=7
After 10 pages i.e.1,2,1,3,7,4,5,6,3,3. page No=3 and page No=3 already present so no page fault hence page fault count=7.