Since you didn't specify a reason for why you want to do it that way. I'll assume you don't know that it is way faster (and imho more precise) to simply set the desired mode, than to flip the flags one after another.
Explained in simplified terms:
Specify 3 numerical values for the set/unset state of all the read, write, and execute flags. For owner, group, and others all at once.
To simplify, I'll stick to 3 digits.
But you should look at the rest of the flags too when you get used to this way of doing it.
To simplify even more:
These 3 values are separate positional values, and not a three digit number. The first one sets the permissions for owner, the next one sets the permissions for group, and the third, sets the permissions for everyone else (others).
Setting the flags:
Now. Determining what each digit means is where some people get confused, but it's really simple when you first learn how it's done.
Here are the flag-values:
Now, you simply do one position at a time, and add (sum) the desired flag-values together. If you want to set read and execute: 4+1=5. If you want read and write but not execute: 4+2=6.
| ### | Owner | Group | Others |
| --- | --- | --- | --- |
| 755 | RWX | R-X | R-X |
| 644 | RW- | R-- | R-- |
Extra info and more examples can be seen here:
So if you want group and others to only have read permission, but owner should have read and write, you simply do
chmod 644 FILENAME
Here's a great tutorial: Understanding Linux File Permissions
One last tip:
Remember that users need execute permission for directories to list the content.