Ever thought about how many times to knock on the door when you are heading into a job interview? In Japan, it matters.

A shortage of young people means there are two job openings for every applicant, prompting some Japanese companies to consider hiring foreign workers. But an interview can be an etiquette minefield, particularly for a nonnative. Even Japanese students have to be drilled on the code, so it’s all the more important for outsiders to be aware of the rules.

“It’s kind of a test of how well you’re trying to fit in,” said Rochelle Kopp, who runs Japan Intercultural Consulting, which helps multicultural workplaces function better. Here’s what you need to know:

Uniformity is paramount: a plain black ensemble known as a “recruit suit,” a simple white shirt and a formal black bag and shoes. Avoid beards, dyed hair, big earrings, heavy make-up, flashy nails and black, white or loud ties. If you’re wearing a coat, take it off before entering the building. This is a sign of respect also used on other solemn occasions — you will rarely see coats worn at a funeral in Japan.

Always knock three times, according to recruitment website Rikunabi. Knocking twice is frowned upon because it’s associated with checking if a toilet cubicle is vacant. Wait until you’re given permission to enter. When you’re inside, turn and close the door without making a loud noise. Don’t try to face forward while doing this. Then, say: “Excuse me,” bow and walk to the left side of the chair. Introduce yourself by name and university and bow again. Wait to be asked before you sit down.

When bowing, don’t just dip your head; bend forward from the hip with a straight back. Keep your arms by your sides and don’t bend your knees. Recruitment site MyNavi recommends a 30-degree bow on entering and a deeper 45 degrees on leaving the interview. Stand still to bow, rather than trying to do so while walking. Once in your seat, sit up straight — don’t lean back. Men should place one hand on each knee. Women should put one hand on top of the other and keep them in their lap.

Use polite language. Japanese has different words for simple concepts such as “I” or “do,” depending on who you’re talking to. Make sure you use the polite terms or you’ll sound as if you’re talking to friends at the bar. If you have to hand over any documents, use both hands to offer them to the interviewer — this is a gesture showing the importance of the transaction.

At the end of the interview, Rikunabi recommends thanking the interviewer and bowing while seated. Then stand and do it again. Say “excuse me” when you leave the room, and close the door quietly after you. Don’t check your phone on your way out — act as formally as if the interview were still going on until you leave the building. Students are often warned that employees could be watching them at any time from the moment they leave the train station to head to the interview.

Never show up late. In Japan, arriving five to 10 minutes before an appointment is regarded as being just in time. And make sure you don’t forget to return your chair to its original position under the desk when you leave the interview room. Kopp says she heard of one promising candidate who was rejected by a Japanese employer for failing to do so, therefore giving the impression of sloppiness.

While interview etiquette may seem complex, it’s nothing compared with the rules facing new graduates once they enter a traditional Japanese company. There are customs for every business situation — from where to stand in an elevator to where to sit in a taxi and how to exchange business cards. Superiors must be treated with great respect, and for a new hire everyone is a superior.

Finally, never make the mistake of assuming the old-fashioned Western custom of “ladies first” applies when entering or leaving a room. In Japan this only leads to confusion and doorway collisions, because seniority takes precedence.