A compound of formula or a pharmaceutically acceptable salt thereof, wherein R 1 is C 1-5 alkyl; C 2-5 alkenyl; C 2-5 alkynyl; or T 0, wherein C 1-5 alkyl; C 2-5 alkenyl; C 2-5 alkynyl are optionally substituted with one or more substituents, which are the same or different and selected from the group consisting of halogen; OH; OCH 3; OCH 2 F; OCHF 2; OCF 3; CN; and T 0; T 0 is C 3-5 cycloalkyl; or 4 to 5 membered saturated heterocyclyl, wherein T 0 is optionally substituted with one or more substituents, which are the same or different and selected from the group consisting of halogen; C 1-5 alkyl; C 2-5 alkenyl; C 2-5 alkynyl; OH; O-C 1-5 alkyl; O-C 2-5 alkenyl; O-C 2-5 alkynyl; and CN, wherein C 1-5 alkyl; C 2-5 alkenyl; C 2-5 alkynyl; O-C 1-5 alkyl; O-C 2-5 alkenyl; and O-C 2-5 alkynyl are optionally substituted with one or more halogen, which are the same or different; n is 1 or 2; X 1 is N; or CH; X 2 is O; S; N-CN; N-OH; or N-OC 1-4 alkyl; X 3 is (CH 2) n1 X 4 (CH 2) n2 R 2; R is F; m is 0, 1, 2, 3, or 4; n1; n2 are independently selected from the group consisting of 0; 1; and 2; X 4 is C; C O; OC; O; C N(R 1a); N(R 1a)C; S 2 N(R 1a); N(R 1a)S 2; S N(R 1a); N(R 1a)S; S 2; S; N(R 1a)S 2 N(R 1b); S; N(R 1a); N(R 1a)C N(R 1b); N(R 1a)C O; or OC N(R 1a); R 1a, R 1b are independently selected from the group consisting of H; C 1-4 alkyl; C 2-4 alkenyl; and C 2-4 alkynyl, wherein C 1-4 alkyl; C 2-4 alkenyl; and C 2-4 alkynyl are optionally substituted with one or more halogen, which are the same or different; R 2 is H; T; or C 1-6 alkyl; C 2-6 alkenyl; or C 2-6 alkynyl, wherein C 1-6 alkyl; C 2-6 alkenyl; and C 2-6 alkynyl are optionally substituted with one or more R 3, which are the same or different; R 3 is halogen; CN; C R 4; C OR 4; OR 4; C N(R 4 R 4a); S 2 N(R 4 R 4a); S N(R 4 R 4a); S 2 R 4; S R 4; N(R 4)S 2 N(R 4a R 4b); SR 4; N(R 4 R 4a); NO 2; OC R 4; N(R 4)C R 4a; N(R 4)SO 2 R 4a; N(R 4)S R 4a; N(R 4)C N(R 4a R 4b); N(R 4)C OR 4a; OC N(R 4 R 4a); or T; R 4, R 4a, R 4b are independently selected from the group consisting of H; T; C 1-6 alkyl; C 2-6 alkenyl; and C 2-6 alkynyl, wherein C 1-6 alkyl; C 2-6 alkenyl; and C 2-6 alkynyl are optionally substituted with one or more R 5, which are the same or different; R 5 is halogen; CN; C R 6; C OR 6; OR 6; C N(R 6 R 6a); S 2 N(R 6 R 6a); S N(R 6 R 6a); S 2 R 6; S R 6; N(R 6)S 2 N(R 6a R 6b); SR 6; N(R 6 R 6a); NO 2; OC R 6; N(R 6)C R 6a; N(R 6)SO 2 R 6a; N(R 6)S R 6a; N(R 6)C N(R 6a R 6b); N(R 6)C OR 6a; OC N(R 6 R 6a); orT; R 6, R 6a, R 6b are independently selected from the group consisting of H; T; C 1-6 alkyl; C 2-6 alkenyl; and C 2-6 alkynyl, wherein C 1-6 alkyl; C 2-6 alkenyl; and C 2-6 alkynyl are optionally substituted with one or more halogen, which are the same or different; T is phenyl; naphthyl; azulenyl; indenyl; indanyl; C 3-7 cycloalkyl; 3 to 7 membered heterocyclyl; or 7 to 11 membered heterobicyclyl, wherein T is optionally substituted with one or more R 7, which are the same or different; R 7 is halogen; CN; C OR 8; OR 8; C R 8; C N(R 8 R 8a); S 2 N(R 8 R 8a); S N(R 8 R 8a); S 2 R 8; S R 8; N(R 8)S 2 N(R 8a R 8b); SR 8; N(R 8 R 8a); NO 2; OC R 8; N(R 8)C R 8a; N(R 8)S 2 R 8a; N(R 8)S R 8a; N(R 8)C OR 8a; N(R 8)C N(R 8a R 8b); OC N(R 8 R 8a); oxo (=O), where the ring is at least partially saturated; T 1; C 1-6 alkyl; C 2-6 alkenyl; or C 2-6 alkynyl, wherein C 1-6 alkyl; C 2-6 alkenyl; and C 2-6 alkynyl are optionally substituted with one or more R 9, which are the same or different; R 8, R 8a, R 8b are independently selected from the group consisting of H; T 1; C 1-6 alkyl; C 2-6 alkenyl; and C 2-6 alkynyl, wherein C 1-6 alkyl; C 2-6 alkenyl; and C 2-6 alkynyl are optionally substituted with one or more R 10, which are the same or different; R 9, R 10 are independently selected from the group consisting of halogen; CN; C R 11; C OR 11; OR 11; C N(R 11 R 11a); S 2 N(R 11 R 11a); S N(R 11 R 11a); S 2 R 11; S R 11; N(R 11)S 2 N(R 11a R 11b); SR 11; N(R 11 R 11a); NO 2; OC R 11; N(R 11)C R 11a; N(R 11)SO 2 R 11a; N(R 11)S R 11a; N(R 11)C N(R 11a R 11b); N(R 11)C OR 11a; OC N(R 11 R 11a); and T 1; R 11, R 11a, R 11b are independently selected from the group consisting of H; T 1; C 1-6 alkyl; C 2-6 alkenyl; and C 2-6 alkynyl, wherein C 1-6 alkyl; C 2-6 alkenyl; and C 2-6 alkynyl are optionally substituted with one or more halogen, which are the same or different; T 1 is phenyl; C 3-7 cycloalkyl; or 3 to 7 membered heterocyclyl, wherein T 1 is optionally substituted with one or more R 12, which are the same or different; R 12 is halogen; CN; C OR 13; OR 13; C R 13; C N(R 13 R 13a); S 2 N(R 13 R 13a); S N(R 13 R 13a); S 2 R 13; S R 13; N(R 13)S 2 N(R 13a R 13b); SR 13; N(R 13 R 13a); NO 2; OC R 13; N(R 13)C R 13a; N(R 13)S 2 R 13a; N(R 13)S R 13a; N(R 13)C OR 13a; N(R 13)C N(R 13a R 13b); OC N(R 13 R 13a); oxo (=O), where the ring is at least partially saturated; C 1-6 alkyl; C 2-6 alkenyl; or C 2-6 alkynyl, wherein C 1-6 alkyl; C 2-6 alkenyl; and C 2-6 alkynyl are optionally substituted with one or more halogen, which are the same or different; R 13, R 13a, R 13b are independently selected from the group consisting of H; C 1-6 alkyl; C 2-6 alkenyl; and C 2-6 alkynyl, wherein C 1-6 alkyl; C 2-6 alkenyl; and C 2-6 alkynyl are optionally substituted with one or more halogen, which are the same or different.